1

I've got a grid control with 6 columns. I use the EditItemTemplate fields to display edit data and I'd like to customize this if possible. Right now, the EditItemTemplate will show any control that I put in there but it only displays it in the column in which the template is in. How can I get it to span across all 6 columns? For instance, the 6 columns are:

First Name | Last Name | Address | City | State | Zip

and when the user clicks the Edit button (in each row), I'd like to show those 6 for edit, but add 1 more control on a row below that, which spans all 6 columns:

First Name | Last Name | Address | City | State | Zip
------------------------------------------------------
UserComments
------------------------------------------------------

Any ideas how I can accomplish this or even if it can be done?

Robert
  • 1,696
  • 3
  • 36
  • 70

1 Answers1

3

You can modify the gridview control by hooking up to the OnRowCreated event.

I found a very comprehensive tutorial here: Rows and Columns Merging in ASP.NET GridView Control

In the posted article, the author takes a gridview like this: http://i.imgur.com/XyaFw.png

And transforms it to this: http://i.imgur.com/XyaFw.png

zeroef
  • 1,949
  • 23
  • 32
  • Thanks a bunch....reading the article now and getting a better understanding as to what to do. – Robert Mar 02 '12 at 16:32
  • 1
    It can be done, and this puts you on the right track. However, be warned that there can be some real challenges to doing this type of structure. Particularly in terms of formatting and getting the columns to line up between your view and edit rows. – Rozwel Mar 02 '12 at 16:51
  • Just wanted to say thanks again for this link. I was able to modify my code to do exactly what I needed and it works great. Thanks again! – Robert Mar 05 '12 at 13:37