I have connected the DefaultView property of a strong-typed datatable to the ItemsSource of the Telerik grid
and most of the data from the grid is not showing in the grid.
When I connect the datatable and not its default view, everything works fine.
This seems to occur when working with a strong-type datatable and not when I create a datatable on the fly.
Help will be most appreciated,
3 Answers, 1 is accepted
I can't reproduce this on my end. How do you define your columns? Do you use UniqueName or DataMemberBinding? Can you check if your bindings or names are the same as the column/property names?
I am attaching a sample project that uses a strongly typed data table and binds to its default view. Can you reproduce the problem there?
the Telerik team
I took you code and made a few changes.
It seems that the problem occurs when the DataTable is empty.
As you can see below, I have remarked out the
"adapter.Fill(products); " row
and added code to add a new line to the datatable.
When I test it, it seems that the data is inputed into the datatable, however the grid
does not show any values in the ProductID column.
I am not sure now that the issue is specificaly tide to strog-type datatable, however it still seems a bit buggy.
Here is the code:
var adapter = new NorthwindTableAdapters.ProductsTableAdapter();
var products = new Northwind.ProductsDataTable();
/* adapter.Fill(products); */
RadGridView1.ItemsSource = products.DefaultView;
private void MyAddRow(bool bAddEmptyRow)
DataTable dt = ((DataView)RadGridView1.ItemsSource).Table;
DataRow r = dt.NewRow();
int index = -1;
if (dt.Rows.Count > 0)
index = (int)dt.Rows[dt.Rows.Count - 1]["ProductID"] + 1;
if (bAddEmptyRow == false)
r.ItemArray = dt.Rows[dt.Rows.Count - 1].ItemArray;
// All of these are must columns.
index = 1;
r["ProductID"] = index;
r["ProductName"] = "Name" + index;
r["Discontinued"] = 0;
if (bAddEmptyRow == true)
//r["Approved"] = 0;
//r["Year"] = DateTime.Now.Year;
//r["VersionID"] = 1;
//r["ActivityName"] = "my test";
//r["OBSID"] = 555;
//r["ApprovalStatusID"] = 0;
private void Button_Click(object sender, RoutedEventArgs e)
I reproduced the problem. I too think this is a bug with the automatic binding creation code that will produce a cell value binding from the column UniqueName, if a DataMemberBinding has not been specified.
I can offer a simple workaround: specify your bindings explicitly like this:
Thanks for the report! I have updated your Telerik points.
the Telerik team