S
Stu Carter
Hi,
ENV: .Net 1.1, VS.Net 2003, ASP.Net
When using the DataBinder.Eval directive in a webform within a Repeater
control, it throws an exception when the datasource is from a
DataTable.Select():
"DataBinder.Eval: 'System.Data.DataRow' does not contain a property
with the name MenuItem."
I am using this directive in the webform:
<%#DataBinder.Eval(Container.DataItem, "MenuItem")%>
It all works fine when the repeater data source is a DataSet table, but when
I set the data source to be generated from a DataTable.Select() (in order to
sort the rows), the exception is thrown.
Now, I can fix it by using this binding method: <%#
((System.Data.DataRow)Container.DataItem)["MenuItem"]%>, but can someone
please explain why this doesn't work when using DataBinder.Eval? Is it a
bug?
Many thanks,
Stu
PS. The binding code that causes the problem is:
ReviewerMenu.DataSource=ReviewerDS.Tables["Menu"].Select("",
"MenuItem");
ReviewerMenu.DataBind();
ENV: .Net 1.1, VS.Net 2003, ASP.Net
When using the DataBinder.Eval directive in a webform within a Repeater
control, it throws an exception when the datasource is from a
DataTable.Select():
"DataBinder.Eval: 'System.Data.DataRow' does not contain a property
with the name MenuItem."
I am using this directive in the webform:
<%#DataBinder.Eval(Container.DataItem, "MenuItem")%>
It all works fine when the repeater data source is a DataSet table, but when
I set the data source to be generated from a DataTable.Select() (in order to
sort the rows), the exception is thrown.
Now, I can fix it by using this binding method: <%#
((System.Data.DataRow)Container.DataItem)["MenuItem"]%>, but can someone
please explain why this doesn't work when using DataBinder.Eval? Is it a
bug?
Many thanks,
Stu
PS. The binding code that causes the problem is:
ReviewerMenu.DataSource=ReviewerDS.Tables["Menu"].Select("",
"MenuItem");
ReviewerMenu.DataBind();