我需要将从数据列表中选择的链接按钮的值分配给标签。
我怎样才能做到这一点?
.aspx 代码
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1"
style="margin-left: 5px"
onselectedindexchanged="DataList1_SelectedIndexChanged">
<ItemTemplate>
<asp:LinkButton ID="LinkButton2" runat="server" Text='<%# Eval("Description") %>' Font-Underline="False" ForeColor="Black" Font-Italic="False" ToolTip="click to open"></asp:LinkButton>
<br />
</ItemTemplate>
</asp:DataList>
<br />
<asp:Label ID="item" runat="server" Text="Label"></asp:Label>
.aspx.cs
protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)
{
item.Text = DataList1.SelectedIndex.ToString();
}