Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dim tblIdTitleHdr = CType(e.Row.Parent, Table)

tblIdTitleHdr.Controls.AddAt(e.Row.RowIndex * 2 + 1, idTitleHdr)


What I have tried:

Here, idTitleHdr is a new GridViewRow.

Basically, what this Code does is to repeat a header for each row in a Gridview. The Code's working fine. I just want to know what the above lines of Code do actually. Any help would be greatly appreciated.

Thanks!
Posted
Updated 1-Mar-19 8:11am
v2

1 solution

It's adding a control (idtitleHdr) to another control's "child control" collection (probably a "panel" type).

Only you know the context: what controls tblIdTitleHdr and idTitleHdr are; and what OTHER CONTROLS are in the collection that cause the "headers" to be inserted over a "range" (i.e .... * 2 + 1).

The order in which controls are added to a (parent) collection influences to order in which they are rendered.
 
Share this answer
 
Comments
Member 13952925 1-Mar-19 14:09pm    
Thanks for the response @Gerry Schmitz. Yeah, I think I understand what that Code does now. BTW, idTitleHdr is a new GridViewRow. Sorry for not mentioning that in the question. :)
Member 13952925 1-Mar-19 15:16pm    
@Gerry Schmitz. May I know what exactly is e.Row.Parent in this case?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900