We help IT Professionals succeed at work.

FooterTemplate for CommandField in Gridview

rwarcup
rwarcup asked
on
3,566 Views
Last Modified: 2012-02-03
Hello,

I'm a newbie and I'm having difficulty with trying to get content into the Footer of same Command Field column on a GridView.

Let me explain further ... currently my markup looks like this:

<asp:CommandField ButtonType="Image" ShowSelectButton="true"  SelectImageUrl="~/Images/Button.gif"></asp:CommandField>
<asp:TemplateField>
  <Itemtemplate />
  <FooterTemplate>
     <asp:ImageButton ID="Button1" ImageUrl="~/Images/Button.gif" runat="server" OnClick="Button1_Click" />
   </FooterTemplate>
</asp:TemplateField>

Which, as expected produces:
 Column1 | Column2
 Button    |
 Button    |
 ...
              | Button

What I would like is:
 Column1 | Column2
 Button    |
 Button    |
 ...
 Button    |

Is it possible to create a FooterTemplate for a CommandField in a GridView? Or is there a work-around for this?

Thanks-in-advance
Regards
Rob
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
So simple :-) ... thanks Edwin!
Regards
Rob
This does not work if you need to get the row of the GridView's selected row from the CommandArgument

      Private Sub GridView1_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand

            GridView1.SelectedIndex = CInt(e.CommandArgument)

gives and error.

How do I get the row or row index?
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.