This is a migrated thread and some comments may be shown as answers.

DropDowncolumn bound to Datatable returns System.Data.DataRowView instead of list from database

1 Answer 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dimitri
Top achievements
Rank 1
Dimitri asked on 07 Dec 2011, 01:39 PM
When I run the code and put the Grid into edit mode  the dropdown column is populated with
seven 'System.Data.DataRowView' rows (which is the number of rows in the Title database table)
I cannot see why the values are not being displayed - instead I am getting the object name.
can anyone help?

This my code on the ItemdataBound Event:

GridEditableItem lEditItem = e.Item
as GridDataItem;
 GridEditManager lEditManager = lEditItem.EditManager;
 GridDropDownColumnEditor lTitle = (GridDropDownListColumnEditor)(lEditManager.GetColumnEditor("ddlTitle"));
DataTable dtTitle = ToDataTable2.ToDataTable(title);  
 lTitle.DataSource=dtTitle;
 lTitle.DataValueField = dtTitle.Columns[0].ToString(); 
 lTitle.DataTextField = dtTitle.Columns[1].ToString(); 
 lTitle.DataBind();

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 12 Dec 2011, 02:24 PM
Hi Dimitri,

I suggest that you go through the forum thread below for more information how to achieve your goal:
http://www.telerik.com/community/forums/aspnet-ajax/grid/griddropdowncolumn-binding-and-selected-value.aspx

Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Dimitri
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or