SqlDBAccess db = new SqlDBAccess(); protected void drpFaculty_SelectedIndexChanged(object sender, EventArgs e) { drpAdvisiorName.Items.Clear(); drpAdvisiorName.Items.Add("<<Select Supervisor Name>>"); try { db.Adapter("select TeacherName from tblTeacherAndDepartment where Department = '"+drpFaculty.SelectedItem.Text.ToString()+"'","teacherName"); //lblerror.Text = drpFaculty.SelectedItem.Text.ToString(); for (int i = 0; i < db.dataSet.Tables["teacherName"].Rows.Count; i++) { //RadioButtonList1.Items.Add(db.dataSet.Tables["teacherName"].Rows[i][0].ToString()); drpAdvisiorName.Items.Add(db.dataSet.Tables["teacherName"].Rows[i][0].ToString()); //.Items.Add(db.dataSet.Tables["teacherName"].Rows[i][0].ToString()); } db.dataSet.Tables["teacherName"].Clear(); } catch (Exception ex) { lblerror.Text = ex.Message.ToString(); } }
<asp:DropDownList ID="drpFaculty" runat="server" style="top: 83px; left: 240px; position: absolute; height: 26px; width: 473px" AutoPostBack="True" onselectedindexchanged="drpFaculty_SelectedIndexChanged"> <asp:ListItem>Agricultural Engineering and Technology</asp:ListItem> <asp:ListItem>Veterinary Science</asp:ListItem> <asp:ListItem>Agriculture</asp:ListItem> <asp:ListItem>Animal Husbandry</asp:ListItem> <asp:ListItem>Agricultural Economics & Rural Sociology</asp:ListItem> <asp:ListItem>Fisheries</asp:ListItem> <asp:ListItem>Social Science</asp:ListItem> <asp:ListItem>Nutrition and Food Science</asp:ListItem> <asp:ListItem>BAM</asp:ListItem> <asp:ListItem>ANSVM</asp:ListItem> <asp:ListItem>Arts and Humanities</asp:ListItem> <asp:ListItem>Biological Science</asp:ListItem> <asp:ListItem>LAW</asp:ListItem> <asp:ListItem>Electrical and Computer Engineering</asp:ListItem> <asp:ListItem>Mechanical</asp:ListItem> <asp:ListItem>Civil Engineering</asp:ListItem> <asp:ListItem>Science</asp:ListItem> </asp:DropDownList>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)