日期:2014-05-18 浏览次数:20996 次
<body> <form id="form1" runat="server"> <div> <% int i = 10; for (int j = 0; j < i; j++) { %> <%=j %> <asp:LinkButton ID="lkbtn" runat="server" Text="删除" CommandArgument="<%=j %>" onclick="lkbtn_Click"></asp:LinkButton> <hr /> <% } %> </div> <asp:TextBox ID="txt" runat="server"></asp:TextBox> </form> </body> protected void lkbtn_Click(object sender, EventArgs e) { string str = (sender as LinkButton).CommandArgument; txt.Text = str; }