Bind a RadDataGrid to a single object

2 posts, 0 answers
  1. Will
    Will avatar
    11 posts
    Member since:
    Apr 2013

    Posted 09 May 2013 Link to this post

    I'm trying to bind a single row to a Telerik RadGridView in WinForms.  Since this list only ever contains one item, it seems inefficient to bind to a "List", even though I know that List only has one item. However, when I try to just bind to a single item in my list, nothing happens. Nothing shows up on my grid, but I don't get an error in the debugger.

    This works. GetObjects is a Dal method that returns a List.

    List<MyObject> myObjects = MyDal.GetObjects(myID); 
    this.myGridView.DataSource = myObjects;


    The following code does NOT work. GetObject is a Dal method that only returns the first element from a List.

    MyObject myObject = MyDal.GetObject(myID); 
    this.myGridView.DataSource = myObject;

    I posted a similar question here .
  2. Stefan
    Stefan avatar
    2911 posts

    Posted 14 May 2013 Link to this post

    Hello Will,

    Thank you for writing.

    Please refer to the following article which explains what are the possibilities for binding RadGridView:

    In your case, you will most likely have to add the object in an BindingList and bind the list to the grid.

    I hope this helps.
    Kind regards,
    the Telerik team
    RadChart for WinForms is obsolete. Now what?
Back to Top