Create multi-row gridview Header with buttons in header

I found a few articles , that try to create multi-row gridview Header
 
All solutions suggest to create extra DataViewRow(s) of a type DataControlRowType.Header on RowDataBound event.
However on Postback DataBind usually is not called, and so RowDataBound event will not occur.
It means that the second header will not be recreated on Postback -not good.
 
Discussion GridView - trouble with double header row has a suggestion to use rowcreated event  that should be called during initial DataBind and during subsequent postback.
 
Using RowCreated event to create additional rows in header works perfectly for me.
 
Note that RowCreated event is called within parent LoadViewState event, but before LoadViewState for individual row.
So not all info could be available at that time.

Alternatively it can be tried on page_load time on PostBack when state has been loaded already as suggested in Access Dynamic GridView ItemTemplate after postback discussion.
I strongly recommend to read a great atricle: TRULY Understanding Dynamic Controls  -Parts 1-4 and avoid using dynamic controls if possible.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted @ Wednesday, March 05, 2008 11:50 PM
Print

Comments on this entry:

# re: Create multi-row gridview Header with buttons in header

Left by Alejandro at 11/16/2010 8:08 AM
Gravatar
Estimado,
Me podrías explicar con mas detalle como lo haces para agregar la fila adicional en la cabecera.
Gracias

# re: Create multi-row gridview Header with buttons in header

Left by Alejandro at 11/16/2010 8:42 AM
Gravatar
Estimated
I could explain in more detail as you do to add the extra row in the header.
Thanks

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910