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

Adding data to GridGroupHeaderItem Controls

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 23 Feb 2009, 03:09 PM
Hello,

I have a Grid that is grouped by a field then I have added Controls to the Header on the Grid.ItemDataBound event. I then want to dynamically set the values of some of these controls. This works well on the ItemDataBound event but it doesn't always get fired, I need to use the ItemCreated event also. The problem there is I am using the following code to get the Grouped By field so I can get the values from the database:

string strtxt = header.DataCell.Text;
        string[] arr = strtxt.Split(':');
        string strGroupByField = arr[1].ToString();
        strGroupByField = Regex.Replace(strGroupByField, @"<(.|\n)*?>", string.Empty);

Unfortunately, this fails when triggered from the ItemDataBound event, I would imagine because it hasn't quite got all the data yet.

Is there a way to force the Grid to use fire the ItemDataBound event everytime?

Thanks!

Andy



1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 26 Feb 2009, 11:18 AM
Hello Andy,

One possible option would be to use the PReRender event handler for the control, and get all the groupheaders in the control (RadGRid1.MasterTableView.GetItems). It is both fired at all times, and contains all the relevant data.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or