Casting Data Row

3 posts, 1 answers
  1. Mansi Mansi
    Mansi Mansi avatar
    15 posts
    Member since:
    Apr 2010

    Posted 02 Apr 2015 Link to this post

    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. Mansi Mansi
    Mansi Mansi avatar
    15 posts
    Member since:
    Apr 2010

    Posted 03 Apr 2015 Link to this post

    ?!
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 06 Apr 2015 Link to this post

    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.

     
Back to Top