예제 #1
0
 protected void DropDownCourse_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DropDownSubject.SelectedValue != "--Select--")
     {
         panelsubject.Visible = true;
         string         selectcmd = "Select Sname from Subjects where Cid =(Select Cid from Course where Cname='" + DropDownCourse.SelectedValue + "')";
         SqlDataAdapter daa1      = new SqlDataAdapter(selectcmd, con);
         DataSet        myDataSet = new DataSet();
         daa1.Fill(myDataSet, "Subjects");
         DropDownSubject.DataSource = myDataSet;
         DropDownSubject.DataBind();
         DropDownSubject.DataTextField  = "Sname";
         DropDownSubject.DataValueField = "Sname";
         DropDownSubject.DataBind();
     }
 }
예제 #2
0
    protected void DropDownCourse_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (Session["Tid"] == null)
        {
            Response.Redirect("Tutorlogin.aspx");
        }
        string tid = Session["Tid"].ToString();

        if (DropDownSubject.SelectedValue != "--Select--")
        {
            panelsubject.Visible = true;
            string         selectcmd = "Select Sname From Subjects where Sbid IN (Select Sbid from TutorSubjects where Cid IN(Select Cid from Course where Cname='" + DropDownCourse.SelectedValue + "') and sbid IN (Select Sbid from TutorSubjects where Tid='" + tid + "') and Tid = '" + tid + "') ";
            SqlDataAdapter daa1      = new SqlDataAdapter(selectcmd, con);
            DataSet        myDataSet = new DataSet();
            daa1.Fill(myDataSet, "Subjects");
            DropDownSubject.DataSource = myDataSet;
            DropDownSubject.DataBind();
            DropDownSubject.DataTextField  = "Sname";
            DropDownSubject.DataValueField = "Sname";
            DropDownSubject.DataBind();
            DropDownSubject.Items.Insert(0, "--Select--");
        }
    }