DataList中添加一个linkbutton空间怎么调用它
我在DataList中添加了一个linkbutton空间,现在我想在隐藏页中调用这个linkbutton空间,我该怎么写?如下:<asp:DataListID="Data...
我在DataList中添加了一个linkbutton空间 ,现在我想在隐藏页中调用这个linkbutton空间,我该怎么写?如下:
<asp:DataList ID="DataList1" runat="server" Style="z-index: 100; left: 92px; position: absolute;
top: 58px" Height="120px" Width="437px" >
<ItemTemplate>
<table border="1" style="width: 523px; height: 1px">
<tr>
<asp:LinkButtonID="LinkButton1"runat="server">LinkButton</asp:LinkButton>
</tr>
</table>
</ItemTemplate>
</asp:DataList> 展开
<asp:DataList ID="DataList1" runat="server" Style="z-index: 100; left: 92px; position: absolute;
top: 58px" Height="120px" Width="437px" >
<ItemTemplate>
<table border="1" style="width: 523px; height: 1px">
<tr>
<asp:LinkButtonID="LinkButton1"runat="server">LinkButton</asp:LinkButton>
</tr>
</table>
</ItemTemplate>
</asp:DataList> 展开
1个回答
展开全部
protected void Page_Init(object sender, EventArgs e)
{
DataList1.ItemDataBound += new DataListItemEventHandler(DataList1_ItemDataBound);
}
private void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton lbtn = (LinkButton)e.Item.FindControl("LinkButton1");
}
}
{
DataList1.ItemDataBound += new DataListItemEventHandler(DataList1_ItemDataBound);
}
private void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
LinkButton lbtn = (LinkButton)e.Item.FindControl("LinkButton1");
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询