Get Underlying Object

3 posts, 0 answers
  1. Greg
    Greg avatar
    29 posts
    Member since:
    Oct 2007

    Posted 12 Mar 2009 Link to this post

    I bind my radGridView to a custom object - let's say a CustomerList that is made up of a bunch of Customer objects.

    How do I get the underlying Customer object from the CurrentRow (or ANY row, for that matter)?


    -- Greg
  2. Krtek
    Krtek avatar
    4 posts
    Member since:
    Mar 2009

    Posted 13 Mar 2009 Link to this post

    You can to this by this code

    if (IsGridDataRowSelected(radGridView)) 
         Customer someVariable = (Customer)radGridView.CurrentRow.DataBoundItem; 
    private bool IsGridDataRowSelected(RadGridView radGridView) 
         return radGridView.Rows.Count > 0 && radGridView.CurrentRow != null && (radGridView.CurrentRow.GetType() == typeof(Telerik.WinControls.UI.GridViewDataRowInfo)); 

  3. DevCraft R3 2016 release webinar banner
  4. Jack
    Jack avatar
    2335 posts

    Posted 13 Mar 2009 Link to this post

    Hi Krtek, you are correct. Thank you for your suggestion.

    Greg, if you have more questions don't hesitate to ask.

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top