Data Gridview Get index of selected row using C Sharp | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

Data Gridview Get index of selected row using C Sharp

Friday

How to Get the index of the SelectedRow in a DataGridView:
                                                                                    You can get the index of the Selected Row in a Data Grid View by using the following c# code.

private void gvCustomer_SelectionChanged(object sender, EventArgs e) 
{ 
   if (gvCustomer.SelectedRows.Count == 1) 
    { 
       txtXML.Text = gvCustomer.Rows[gvCustomer.SelectedRows[0].Index].Cells["CustomerCode"].Value.ToString(); 
    } 
}

1 comments:

Anonymous said...

Group gridview rows with header in C#

Post a Comment

Share your thoughts here...

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets