Get Underlying Object

3 posts, 0 answers
  1. Greg
    Greg avatar
    33 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. Jack
    Jack avatar
    2333 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