index.aspx文件如下<%@ Register TagPrefix="header" TagName="top" src="top.ascx"%>
<%@ Page Language="vb" AutoEventWireup="false" Inherits="vod.index" Codebehind="index.aspx.vb"%>
<header:top id="top1" runat="server" />top.ascx文件如下
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="top.ascx.vb" Inherits="vod.top" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<tr>
<td vAlign="top" height="12"><IMG height="24" src="images/top10.gif" width="197"></td>
</tr>
<tr>
<td vAlign="top">
<table cellSpacing="0" cellPadding="2" width="95%" align="center" border="0">
<tr>
<td colSpan="2" height="13">
<asp:DataGrid id="DataGrid1" runat="server" BorderWidth="0" AutoGenerateColumns="false" Width="95%"
HorizontalAlign="Center" CellPadding="2" CellSpacing="0">
<Columns>
<asp:BoundColumn HeaderText="名次" DataField="IntegerValue" ItemStyle-Width="20" ItemStyle-CssClass="b8"
ItemStyle-VerticalAlign="Middle" ItemStyle-ForeColor="#ffcc00" ItemStyle-Font-Size="9" />
<asp:HyperLinkColumn HeaderText="电影名称" DataNavigateUrlField="IntegerValueUrl" DataNavigateUrlFormatString="movie.aspx?id={0}"
DataTextField="StringValue" ItemStyle-ForeColor="#ffffff" />
</Columns>
</asp:DataGrid></td>
</tr>
</table>
</td>
</tr>
我想把index.aspx.vb里的值传递到top.ascx.vb,应该如何做?
如何在<header:top id="top1" runat="server" />里加属性传到top.ascx.vb里?
比如说:<header:top id="top1" runat="server" TestValue="123" />
我应该如何在top.ascx.vb定义,并接收它?
<%@ Page Language="vb" AutoEventWireup="false" Inherits="vod.index" Codebehind="index.aspx.vb"%>
<header:top id="top1" runat="server" />top.ascx文件如下
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="top.ascx.vb" Inherits="vod.top" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<tr>
<td vAlign="top" height="12"><IMG height="24" src="images/top10.gif" width="197"></td>
</tr>
<tr>
<td vAlign="top">
<table cellSpacing="0" cellPadding="2" width="95%" align="center" border="0">
<tr>
<td colSpan="2" height="13">
<asp:DataGrid id="DataGrid1" runat="server" BorderWidth="0" AutoGenerateColumns="false" Width="95%"
HorizontalAlign="Center" CellPadding="2" CellSpacing="0">
<Columns>
<asp:BoundColumn HeaderText="名次" DataField="IntegerValue" ItemStyle-Width="20" ItemStyle-CssClass="b8"
ItemStyle-VerticalAlign="Middle" ItemStyle-ForeColor="#ffcc00" ItemStyle-Font-Size="9" />
<asp:HyperLinkColumn HeaderText="电影名称" DataNavigateUrlField="IntegerValueUrl" DataNavigateUrlFormatString="movie.aspx?id={0}"
DataTextField="StringValue" ItemStyle-ForeColor="#ffffff" />
</Columns>
</asp:DataGrid></td>
</tr>
</table>
</td>
</tr>
我想把index.aspx.vb里的值传递到top.ascx.vb,应该如何做?
如何在<header:top id="top1" runat="server" />里加属性传到top.ascx.vb里?
比如说:<header:top id="top1" runat="server" TestValue="123" />
我应该如何在top.ascx.vb定义,并接收它?
public string TestValue
Public writeonly Property testvalue() As String
Set(ByVal Value As String)
TextBox1.Text= Value '当然也可以把属性值传给别的控件
End Set
End Property
private ms as String = String.Empty
public Property TestValue() As String
get
return ms
end get
Set(ByVal Value As String)
ms = Value
end
end property2. in index.aspx.vbnamespace vodpublic class index
protected top1 as top 'top1 is the id in your aspx page sub page_Load()
top1.TestValue = "abc"
end sub