DropDownList
-
Hi, I get the following error: 'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'DatatValueField' My code : string sqlStmt = null; sqlStmt = "GetProjest";//stored proc SqlCommand cmd = new SqlCommand(); cmd.CommandText = sqlStmt; cmd.CommandType = CommandType.StoredProcedure; SqlDataReader sqlReader = cmd.ExecuteReader(); if(sqlReader.HasRows) { ProjectidList.DataSource = sqlReader; ProjectidList.DataTextField = "Project_ID"; ProjectidList.DatatValueField = "Project_ID"; ProjectidList.DataBind(); }
-
Hi, I get the following error: 'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'DatatValueField' My code : string sqlStmt = null; sqlStmt = "GetProjest";//stored proc SqlCommand cmd = new SqlCommand(); cmd.CommandText = sqlStmt; cmd.CommandType = CommandType.StoredProcedure; SqlDataReader sqlReader = cmd.ExecuteReader(); if(sqlReader.HasRows) { ProjectidList.DataSource = sqlReader; ProjectidList.DataTextField = "Project_ID"; ProjectidList.DatatValueField = "Project_ID"; ProjectidList.DataBind(); }
This cannot be real....Read the error, it tells you exactly what's wrong. You misspelled the property. There is an extra "t". What you wrote
ProjectidList.DatatValueField = "Project_ID";
What you should have written:
ProjectidList.DataValueField = "Project_ID";
I will use Google before asking dumb questions