怎么获取datalist里面的linkbutton的值?datalist是绑定的!
<asp:DataListID="DataList1"runat="server"DataKeyField="HeadImgID"DataSourceID="SqlDat...
<asp:DataList ID="DataList1" runat="server" DataKeyField="HeadImgID" DataSourceID="SqlDataSource1" RepeatColumns="5"> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# Eval("HeadImg", "F:/touxiang/max/{0}") %>' /><br /> <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("HeadImg", "{0}") %>'></asp:LinkButton> </ItemTemplate> </asp:DataList> 现在是要在同一个页面获取到linkbutton的值 for (int i = 0; i < DataList1.Items.Count; i++) { LinkButton lbl = (LinkButton)this.DataList1.Items[i].FindControl("LinkButton2"); this.Label2.Text = lbl.Text; } 这招没用
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询