Personal Blog of Mustafa Basgun

Manipulating ColSpan Attribute of Footer Row in GridView

with 8 comments

There may be some cases that the Footer of a GridView is desired to be displayed as one cell, which means setting the ColumnSpan property of the Footer’s first cell to the number of columns of the GridView. As there are some other possible workarounds to accomplish this, here is my way by adding a few lines to the OnRowCreated method.

First, make sure that ShowFooter property of the GridView is set to True:

01202008_1.gif

VB.NET:

01202008_2.gif

C#:

01202008_3.gif

Advertisements

Written by Mustafa Basgun

January 20, 2008 at 2:00 PM

8 Responses

Subscribe to comments with RSS.

  1. Perfect! Copy-and-paste code samples would be nice.

    Ben

    May 15, 2008 at 3:32 PM

  2. Why do you put the code samples as image? I can not copy.

    Anz

    May 25, 2009 at 6:05 AM

  3. Thanks for the code sample. It worked great.

    Anz

    May 25, 2009 at 6:07 AM

  4. Wow, that was helpful. Thanks for the nice tip!
    I do agree. It would be nice if the code was text instead of images :)

    Aaron

    July 28, 2009 at 10:34 AM

  5. I think this is the add-in utility I use to copy code and convert it to highlighted HTML:

    http://copysourceashtml.codeplex.com/

    Check it out! Thanks for the tip.

    Chad

    December 13, 2009 at 9:53 PM

  6. This code worked for me. Thanks.

    Prashant Kene

    August 18, 2014 at 2:05 AM

  7. Works great! I needed my last column to be outside of the colspan so I simply changed to
    Dim m As Integer = e.Row.Cells.Count – 1
    That way I could add a FooterTemplate inside my last TemplateField.

    AndreP

    October 19, 2014 at 2:23 PM

  8. Thank you very much, your code saved my day. I can’t believe so many ungrateful people on here. This guy solved your problem and you complaining you can’t copy the code. Type it in.

    Ted

    May 14, 2015 at 5:43 AM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: