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

Casting Data Row

2 Answers 359 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mansi A.
Top achievements
Rank 1
Mansi A. asked on 02 Apr 2015, 09:24 AM
Hello, 
   I bind grid view data source to TblProduct , Currently on row click I get value of each column ( visible / hidden ) 
  Is there anyway to cast/extract data row based on datasource object ? 

  so instead of 
 rtID.Text = RGProduct.CurrentRow.Cells["ProductId"].Value.ToString();
 rtName.Text = RGProduct.CurrentRow.Cells["ProductName"].Value.ToString();
....... for another 12 columns 

  will do something like 
  
  TblProduct p = new TblProduct();
  p =  RGProduct.CurrentRow.something that will bring back only bind columns 

Thank You 
Mansi 

2 Answers, 1 is accepted

Sort by
0
Mansi A.
Top achievements
Rank 1
answered on 03 Apr 2015, 12:56 PM
?!
0
Accepted
Dimitar
Telerik team
answered on 06 Apr 2015, 10:56 AM
Hi Mansi,

Thank you for writing.

Yes this is supported, you can just use the DataBoundItem property: 
DataRowView data = radGridView1.CurrentRow.DataBoundItem as DataRowView;

If you have any questions, please do not hesitate to contact us.
 
Regards,
Dimitar
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
GridView
Asked by
Mansi A.
Top achievements
Rank 1
Answers by
Mansi A.
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or