How to access dynamically created Gridview HeaderRow
-
In my scenario, I need to group the products based on category. The "main" header has columns Product name, Description, Unit and Unitprice. I am programatically adding "secondary" / "sub" header for each cateogry and list the respective product underneath. I overrode the render function like this GridViewRow NewHeader = new GridViewRow(rowIndex + 1, rowIndex + 1, DataControlRowType.Header, DataControlRowState.Normal); GridView1.Controls[0].Rows.AddAt(rowIndex + 1, NewHeader); The gridview is created as wished - First appears the main header. And Comes the first sub header followed by the related product rows and then comes the next subheader followed by the corresponding product rows at it goes on. I want to know how can I access these dynamically created "sub header"s. Gridview1.rows collection has only the data rows and the Gridview1.headerrow has only the default headerr row. Is there a way to access my "sub"header rows? Thanks Kit