Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I set the first row selected by default (by starting) in DataTable ?

I try dV1.Table.Rows[0]..., where dV1 is my DataView that is a property binding to my DataGrid. I don't want to set the first row selected in my dataGrid directly. Is it possible?
Posted

1 solution

If you dont want to select any row then
C#
gridView1.DataBind();
gridView1.SelectedIndex = -1;


If you want to select particular row then give that no
C#
gridView1.DataBind();
gridView1.SelectedIndex = 2;
 
Share this answer
 
Comments
bw2012 3-Dec-12 7:38am    
Sorry, but I have no GridView
pradiprenushe 3-Dec-12 23:19pm    
instead of gridviewid use datagrid id.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900