您必须处理<代码>ItemCommand的雷患控制活动。
标记:
<asp:Repeater ID="Repeater1" runat="server"
onitemcommand="Repeater1_ItemCommand">
<ItemTemplate>
<asp:LinkButton
ID="LinkButton1"
runat="server"
CommandName="cmd"
CommandArgument= <%#Eval("Name") %>
Text="Click Here"
>
</asp:LinkButton>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:Repeater>
法典:
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "cmd")
{
TextBox tx = e.Item.FindControl("TextBox1") as TextBox;
tx.Text = e.CommandArgument.ToString();
}
}