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

Type of Row Selected

1 Answer 116 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Xavier Soares
Top achievements
Rank 2
Xavier Soares asked on 13 Jun 2008, 05:19 PM
Hello,

How can I get the type of row selected/clicked in radgridview?

I'using a radgridview(master) to show data in another radgridview (detail)  evertime that a user clicks in the master radgridview. This works fine when the master radgridview isnĀ“t filtered or grouped.

When the radgridview is filtered or grouped and the user clicks in the (+) symbol to expand de row  I get the following error:

System.InvalidCastException: Unable to cast object of type 'Telerik.WinControls.UI.GridViewGroupRowInfo' to type 'Telerik.WinControls.UI.GridViewDataRowInfo'.

The error is generated in the event  CurrentRowChanged

How can I detect the type of row selected/clicked or disable that event to prevent this error?

Thank for your support.
LM

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 16 Jun 2008, 11:17 AM
Hi Luis,

Thank you for writing.

You can use the following code snippet in the handler of the CurrentRowChanged event to make sure that your logic only gets executed for the data rows:

private void gridView_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e) 
    if (e.CurrentRow is GridViewDataRowInfo) 
    { 
        // your logic here.... 
    } 
    else if (e.CurrentRow is GridViewGroupRowInfo) 
    { 
 
    } 

I hope this helps. If you have any questions, please let me know.

Kind regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Xavier Soares
Top achievements
Rank 2
Answers by
Julian Benkov
Telerik team
Share this question
or