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 !
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhijit baruaPosted Aug 9, 2012, 12:40 AM
Deepak VermaPosted Aug 8, 2012, 11:28 PM
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.
}