Renjith Stephen
Renjith Stephen

Reputation: 95

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

while i am trying to bind my drop down button "DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Name'." occurs. help me to overcome this. thanks in advance.

the code am using is

var at = _dbConnect.GetData_DataTable("select * from Employee a where a.department = '3' order by Name");
    ddlPerson.DataSource = cat;
    ddlPerson.DataTextField = "Name";
    ddlPerson.DataValueField = "id";
    ddlPerson.DataBind();
    ddlPerson.Items.Add(new ListItem(" MY NAME ", "0"));
    ddlPerson.SelectedValue = "0";

Upvotes: 0

Views: 710

Answers (2)

Renjith Stephen
Renjith Stephen

Reputation: 95

var at = _dbConnect.GetData_DataTable("select * from Employee a where a.department = '3' order by Name");
ddlPerson.DataSource = **at**;

thanks for the answers and suggestions

Upvotes: 0

stevieg
stevieg

Reputation: 662

Is the database field called "name" rather than "Name"?

Upvotes: 0

Related Questions