Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataBinding: 'System.Data.DataRowView' does not contain a property

Status
Not open for further replies.

kkhbjh

Technical User
Feb 21, 2003
2
NL
Hi all,

I am facing a problem with databinding in a gridview. Im converting an XML result into a dataset and then databind the table to a gridview.

gvResults.DataSource = DSjoinTable.Tables["DOCUMENT"].DefaultView;
gvResults.DataBind();

To show the column values in the gridview I use:

<%# Eval ( "LASTAUTHOR") %>

However, Im receiving the error

DataBinding: 'System.Data.DataRowView' does not contain a property with the name LASTAUTHOR

if this field does not exists in the table and thus does not exists in the XML. Can I catch this exception in the aspx page in the EVAL statement and print N/A for example?

The problem is that I don't have control over the XML so I dont know on forehand if the field exists or not in the XML.

Many thanks for any input.

Leo

 
if your loading the data from xml into a table then all the columns should be defined. if not,define the columns for the table with default values. then load the xml. then bind to the grid. this way you don't need to worry about if/else statements all over the place.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top