Harry89pl
Harry89pl

Reputation: 2435

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.

Upvotes: 0

Views: 9569

Answers (2)

Tim B James
Tim B James

Reputation: 20364

<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.

Upvotes: 2

Bala R
Bala R

Reputation: 108957

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.

Upvotes: 2

Related Questions