Brett Bretterso
12-07-2005, 12:02 AM
I'm trying to have a dropdownlist that's populated from a database using databind that has a default value that doesn't come from the database.
qryStr="select id, lName+', '+fName as fullName from people";
OleDbCommand cmd = new OleDbCommand(qryStr, cn);
OleDbDataReader rdr = cmd.ExecuteReader();
selectPerson.DataSource = rdr;
selectPerson.DataTextField = "fullName";
selectPerson.DataValueField = "id";
selectPerson.DataBind();
let's say this makes it so the dropdownlist has Pizza Head and Lasagna Face, but I want to make it so at the top of the list it says something like "Select a Person". How can I do that?
Brett Bretterson
qryStr="select id, lName+', '+fName as fullName from people";
OleDbCommand cmd = new OleDbCommand(qryStr, cn);
OleDbDataReader rdr = cmd.ExecuteReader();
selectPerson.DataSource = rdr;
selectPerson.DataTextField = "fullName";
selectPerson.DataValueField = "id";
selectPerson.DataBind();
let's say this makes it so the dropdownlist has Pizza Head and Lasagna Face, but I want to make it so at the top of the list it says something like "Select a Person". How can I do that?
Brett Bretterson