开发者

How to add 5 Textboxes and 1 button to GridView in footer ASP.NET?

Like in title? have no idea how to do it

I wrote something like this:

<Columns>
     <asp:TemplateField>
          <FooterTemplate>
              <asp:TextBox ID="TextBox1" runat="server" />
              <asp:TextBox ID="TextBox2" runat="server" />
              <asp:TextBox ID="TextBox3" runat="server" />
              <asp:TextBox ID="TextBox4" runat="server" />
              <asp:TextBox ID="TextBox5" runat="server" />
  开发者_开发问答            <asp:Button ID="Button1" runat="server" />
          </FooterTemplate>
     </asp:TemplateField>

     <asp:CommandField ShowEditButton="True" />
          <asp:BoundField DataField="id" HeaderText="ID" Visible="False" />
          <asp:BoundField DataField="Name" HeaderText="Name" />
          <asp:BoundField DataField="LastName" HeaderText="LastName" />
          <asp:BoundField DataField="something" HeaderText="something" />
          <asp:BoundField DataField="country" HeaderText="country" />
          <asp:CommandField ShowDeleteButton="True" />
</Columns>

but it gives me extra column i want to add this textbox in the column that already exists.


<asp:GridView ID="GridView1" runat="server" ShowFooter="true">
    <Columns>
        <asp:TemplateField>
            <FooterTemplate>
                <asp:TextBox ID="TextBox1" runat="server" />
                <asp:TextBox ID="TextBox2" runat="server" />
                <asp:TextBox ID="TextBox3" runat="server" />
                <asp:TextBox ID="TextBox4" runat="server" />
                <asp:TextBox ID="TextBox5" runat="server" />
                <asp:Button ID="Button1" runat="server" />
            </FooterTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

That is how.


Set ShowFooter To true for your GridView and define FooterTemplate for whichever column you would like the footer to be shown and add the 5 Textboxes and 1 Button to this template section.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜