telerik - Bind a GridView to a single object -
i'm trying bind single row telerik radgridview, think question might apply gridview control. since list ever contains 1 item, seems inefficient bind "list", though know list has 1 item. however, when try bind single item in list, nothing happens. nothing shows on grid, don't error in debugger.
this works. getobjects dal method returns list.
list<myobject> myobjects = mydal.getobjects(myid); this.mygridview.datasource = myobjects;
the following code not work. getobject dal method returns first element list.
myobject myobject = mydal.getobject(myid); this.mygridview.datasource = myobject;
i tried code bound object called class1 , works fine using method:
list<myobject> _list1=new list<myobject>(); _list1.add(mydal.getobject(myid)); radgrid1.datasource=_list1; radgrid1.databind();
the reason grid should bound ilistsource, ienumerable, or idatasource.
regards
Comments
Post a Comment