none
GridView 的Button1_Click 迴圈問題??? RRS feed

  • 問題

  • <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
       
        </div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
            <Columns>
                <asp:TemplateField HeaderText="a">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        </form>
    </body>
    </html>

    Partial Class Default2
        Inherits System.Web.UI.Page
     
        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        End Sub
    End Class

    請問Protected Sub Button1_Click我如有N個可以寫成迴圈

    FOR I=1 TO100 的方式來代替 Protected Sub Button1_Click <===1的這值

    不知有何方法可以,還是有100就得寫100個???

    2014年5月11日 下午 03:05

解答

所有回覆