This is a migrated thread and some comments may be shown as answers.

ItemDataBound called twice for GridItemType.Header

3 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 10 Aug 2012, 02:18 PM
I have        
void rgtClients_ItemDataBound(object sender, GridItemEventArgs e)
{
switch (e.Item.ItemType)
{
                case Telerik.Web.UI.GridItemType.Header
....
}
but what is happening the case Telerik.Web.UI.GridItemType.Header is executed twice for the same e.Item.ItemIndex) 
So I have to keep track which row I am at, with if (intCurrentGridIndex != e.Item.ItemIndex)
What will cause such behavior? Should't it be iterating through rows, including header?

3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 15 Aug 2012, 09:52 AM
Hello,

 Normally the ItemDataBound event should be called only once for each item that is created. If it is called twice there are most likely two HeaderItems in the grid depending on how you have configured the control and whether you have any additional code that interacts with the items.
It will be helpful if you can share the markup for the grid and any related code-behind so we can check it on our side and let you know what is causing the problem.

Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Martin
Top achievements
Rank 1
answered on 15 Aug 2012, 02:21 PM
Thank you for getting back to me, headers are defined as so
                    <telerik:GridTemplateColumn>
                        <HeaderTemplate>
...
Also two header rows contain a checkbox
I hope this help
0
Marin
Telerik team
answered on 16 Aug 2012, 07:02 AM
Hello,

 Can you share the full markup of the grid so we can have a better idea of what is your full configuration. A screenshot with the two header rows will also be helpful.

Regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Marin
Telerik team
Martin
Top achievements
Rank 1
Share this question
or