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

Selected Row by Default

1 Answer 76 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vuyiswa
Top achievements
Rank 2
Vuyiswa asked on 05 May 2011, 01:35 PM
Good Day

I have a Radgrid on a Windows app. Win apps are not really my field. Now i have binded the Datagrid from the Datatable and everything is fine. Now on "SelectCanged" event i show a Child window, now my problem is that after the grid is being binded the event gets Fired and the first record gets selected. Now this behavior its a bit annoying for me. Is there any way to turn it off ?

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 06 May 2011, 08:45 AM
Hello Vuyiswa Maseko,

Sadly there is no property that will do this, but the easiest way to accomplish this is to NOT register from the designer to the SelectionChanged event, but to do this in the form Load:

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    radGridView1.ClearSelection();
    radGridView1.CurrentRow = null;
    radGridView1.SelectionChanged += new EventHandler(radGridView1_SelectionChanged);
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
Tags
GridView
Asked by
Vuyiswa
Top achievements
Rank 2
Answers by
Emanuel Varga
Top achievements
Rank 1
Share this question
or