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

Can I get the drouped value clicking on the header row?

2 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Warren
Top achievements
Rank 1
Warren asked on 26 Apr 2014, 03:11 AM
Hello,

I have a gridview that is grouped by a job number. I have all of the rows collapsed. I can expand a group and click on a row within and get the value of the job number. Is there any way of leaving it collapsed and clicking on the group header row and get the grouped value which is the job number for me? I tried and get the error of Object reference not set to an instance of an object. I assume because the cell for that name is not in the row. Is there a different way to get it?

Thanks,

Warren

2 Answers, 1 is accepted

Sort by
0
Warren
Top achievements
Rank 1
answered on 26 Apr 2014, 08:24 PM
I meant to say grouped in the title. Anyways, I found the answer. Here it is in case anyone else needs it.

Warren

e.Row.Group.Header.ToString
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Apr 2014, 08:00 AM
Hello Warren,

Thank you for writing.

I am glad that you found a suitable solution for your requirement. Getting the Row.Group.Header is the appropriate way to access the value of the group row:
private void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
{
    string groupTitle = e.Row.Group.Header;
}

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Warren
Top achievements
Rank 1
Answers by
Warren
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or