How to fill student name in StudentList Dropdown List from two tables, Student and UserInfo tables.Both tables have this field.
Please show me detail information about ASP .net code and also code behind .Thanks !
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Deepak VermaRank #672 · 3.6K reputationPosted Aug 8, 2012, 7:28 PM EDT
This is a sample, change it accordingly.
ASPX Code
<asp:DropDownList ID="DropDownList1" runat="server">
asp:DropDownList>
Code Behind
DataTable dataTable = new DataTable();
dataTable = FillDataTable(); //Method to get records from database.
DropDownList1.DataSource = dataTable;
DropDownList1.DataTextField = "StudentName";
DropDownList1.DataValueField = "StudentId";
DropDownList1.DataBind();
--------------------------------------------------
DataTable FillDataTable()
{
//Code to retrieve records from database.
}
Abhijit baruaRank #3,722 · 397 reputationPosted Aug 8, 2012, 8:40 PM EDT