I have a gridview and when gridview clicked
In shortly, I wonder How can I get Customerid of selected row inside RadGrid1_Itemcommand, moreover, In my trials I see e.Item.ItemIndex give the index of selected rows but because I use some filterings I have no chance to use datatable column property and besides, radgrid has no rows collection to iterate throıgh rows. Pls help me how can I find CustomerId without having DataKeyValues
All helps will be appreciated, thank you in advance.
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == "RowClick" && e.Item is GridDataItem) |
| { |
| GridEditableItem eeditedItem = e.Item as GridEditableItem; |
| int customerId = Convert.ToInt32(editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CustomerId"]); |
| } |
| } |
use the above code block to take CustomerId of selected customer which was written by one of board members. But I have no datakeyvalues because mygridview use needdatasource and advance binding as below
| protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| RadGrid1.DataSource = GetDataTable("SELECT Customerid,CustomerName,CustomerSurname FROM Customers "); |
| } |
In shortly, I wonder How can I get Customerid of selected row inside RadGrid1_Itemcommand, moreover, In my trials I see e.Item.ItemIndex give the index of selected rows but because I use some filterings I have no chance to use datatable column property and besides, radgrid has no rows collection to iterate throıgh rows. Pls help me how can I find CustomerId without having DataKeyValues
All helps will be appreciated, thank you in advance.