<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<tr>
<td ><%# Container.ItemIndex+1 %></td>
<td><asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'></asp:Label></td>
<td ><asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("title") %>'></asp:TextBox></td>
</tr>
</ItemTemplate>
</asp:Repeater> 在使用TextBox tx = (TextBox)Repeater1.Items[1].Controls[3];时我要获取TextBox1的值Controls[3]为什么是3,而不是2,而且用Controls[*].GetType()得到的类型分别是
Controls[0]***********System.Web.UI.DataBoundLiteralControl
Controls[1]***********System.Web.UI.Label 这里是不是说明该控件就是Label1
Controls[2]***********System.Web.UI.LiteralControl 这里怎么不是TextBox1
Controls[3]***********System.Web.UI.TextBox 怎么到3才是TextBox1
<ItemTemplate>
<tr>
<td ><%# Container.ItemIndex+1 %></td>
<td><asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'></asp:Label></td>
<td ><asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("title") %>'></asp:TextBox></td>
</tr>
</ItemTemplate>
</asp:Repeater> 在使用TextBox tx = (TextBox)Repeater1.Items[1].Controls[3];时我要获取TextBox1的值Controls[3]为什么是3,而不是2,而且用Controls[*].GetType()得到的类型分别是
Controls[0]***********System.Web.UI.DataBoundLiteralControl
Controls[1]***********System.Web.UI.Label 这里是不是说明该控件就是Label1
Controls[2]***********System.Web.UI.LiteralControl 这里怎么不是TextBox1
Controls[3]***********System.Web.UI.TextBox 怎么到3才是TextBox1
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货