Click here to Skip to main content
15,900,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem. I want to bind a dropdown using a string array. I am using a session which is called from another page. Session is working fine now the problem is when I bind the dropdown it throw an error..
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Name'


C#
if (Session["Driver"] != null)
{
    string[] arr_list = (string[])Session["Driver"];
    DDDriver.DataSource = arr_list;
    DDDriver.DataBind();  //<b>Error here.....</b>
    DDDriver.Items.Add("select");
    DDDriver.SelectedItem.Text = "select";
}

Error: System.String' does not contain a property with the name 'Driver_Name'.
Posted
Updated 4-Sep-11 23:32pm
v3
Comments
Prerak Patel 5-Sep-11 5:27am    
Use code block for code segments.

You are setting one of these properties on the drop down DataTextField, DataValueField to 'Driver_Name'. removing this should clear the error as well.
 
Share this answer
 
Thanx Vivek..It Works..Bingo Dude :)
 
Share this answer
 
C#
string[] a = new string[] {"Arun","vinay","Manju","Pavan" };
        DropDownList1.DataSource = a.ToArray();
        DropDownList1.DataBind();



Check this out
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900