ASP Snippets

Categories






Alerts

Free Alerts

Your email will always be
private and will not be shared.




Follow us on twitter.




Zoom In | Zoom Out


Author is awarded Most Valuable Professional award by Microsoft ASP/ASP.Net

Exception - DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'x'

Author:Mudassar Khan

Server Error in '/ASP.Net' Application.


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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID'.

 

Cause

The above exception occurs when a specified data item in the web control does not exist in the schema of the returned DataRowView. In other words the column that you have specified with the databound control is not present in the data returned from database

 

Solution

1. Generally occurs due to misspelled column names, hence one should recheck that.

2. If the column names in the Control is correct the check what columns your query is returning and the column that you have specified to the control exists or not.

3. Many times due to exceptions nothing is returned in that case check the code for such issues.

 

Examples

1. If one specifies DataKeyNames property as ID and the actual column name is CustomerID. It will throw the above error.

2. If one specifies DataTextField or DataValueField property as ID and the actual column name is CustomerID. It will throw the above error.

 

Overall it is a minor issue and can be easily solved using the above steps

Posted: May 24 2009, 02:37 by Mudassar Khan | Comments (1) RSS comment feed |
Views: 3274
Page copy protected against web site content infringement by Copyscape


If you like this article, help us grow by bookmarking this page on any social bookmarking site.
Bookmark and Share





Comments

Add comment


 

biuquote
  • Comment
  • Preview
Loading




0  +  0  =   










Community News





Web Hosting SpotLight


Consulting


For consulting and work related queries click here.



Advertise


Advertise with us. For more details click here.


Suggestions


Please provide your valuable suggesstions here.

This Site is hosted on

Lunarpages.com Web Hosting