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.

posted @ Wednesday, March 05, 2008 11:50 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 2 and 6 and type the answer here:
 

Live Comment Preview:

 
«December»
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910