DataBind/DataSource problem
I have this Code:
myConnection.Open()
CommandText = "SELECT * FROM Students ORDER BY Students.firsName"
myCommand = New SqlCommand(CommandText, myConnection)
chooseStudent.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
'Here is the problem
chooseStudent.DataTextField = "firsName" + "|" + "familyName"
chooseStudent.DataValueField = "firsName"
chooseStudent.DataBind()
In this code "chooseStudent" is a DropDownList which contain all students name.
I want that the value of each option (ListItem) will be the first name, But I want that the text will be "firstName" + "|" + "familyName".
(Like "Brad|Pit", "Gorge|Bush" and so......)
How to do it???
|