C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Error: DataBinding: 'System.Char' does not contain a property with the name 'Site Name'.


Posted Date: 28 Aug 2008      Total Responses: 1

Posted By: vinay       Member Level: Bronze     Points: 1


hi,

While i am try to bind data to Dropdownlist, i get the below error.

"DataBinding: 'System.Char' does not contain a property with the name 'Site Name'"

Code:

ddlSiteNames.DataTextField = dtTable.Columns["Site Name"].ToString();
ddlSiteNames.DataValueField = dtTable.Columns["SnagId"].ToString();
ddlSiteNames.DataSource = dtTable.Columns["Site Name"].ToString();
ddlSiteNames.DataBind();


Thanks
Vinay




Responses

Author: Ritesh N. Jain    28 Aug 2008Member Level: GoldRating:     Points: 4
As you already know the name of coulmn in advanced so why to use Datatable to get the name?also you need to pass datatable to ddl's datasource and not column name,
simply change your above code with this one

ddlSiteNames.DataTextField ="Site Name";
ddlSiteNames.DataValueField = "SnagId"
ddlSiteNames.DataSource = dtTable
ddlSiteNames.DataBind();




Post Reply
You must Sign In to post a response.
Next : Free Asp.Net Books
Previous : Insert using a checkboxes in a gridview
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use