コード例 #1
0
    protected void DropEducationType_SelectedIndexChanged(object sender, EventArgs e)
    {
        int id = int.Parse(DropEducationType.SelectedItem.Value);

        if (id > 0)
        {
            DropEducationLevel.Enabled = true;
        }

        DataSet ds = new DataSet();

        ds = objDALLevelType.GetLevelByType(id);
        if (ds.Tables[0].Rows.Count > 0)
        {
            DropEducationLevel.Items.Clear();
            DropEducationLevel.DataSource     = ds.Tables[0];
            DropEducationLevel.DataTextField  = "EduLevel_Name";
            DropEducationLevel.DataValueField = "EduLevel_Id";
            //DropEducationLevel.SelectedValue = "EduType_Id";
            DropEducationLevel.DataBind();
            DropEducationLevel.Items.Insert(0, new ListItem("--Select Education Level--", "-1"));
        }
        else
        {
            DropEducationLevel.DataSource = null;
            DropEducationLevel.DataBind();
        }
    }
コード例 #2
0
 void BindEducationLevelDetails()
 {
     try
     {
         DataSet ds = new DataSet();
         ds = objDALEdu.GetEduLevel(objEducation);
         if (ds.Tables[0].Rows.Count > 0)
         {
             DropEducationLevel.DataSource     = ds.Tables[0];
             DropEducationLevel.DataTextField  = "EduLevel_Name";
             DropEducationLevel.DataValueField = "EduLevel_Id";
             DropEducationLevel.SelectedValue  = "EduType_Id";
             DropEducationLevel.DataBind();
             DropEducationLevel.Items.Insert(0, new ListItem("--Select Education Level--", "-1"));
         }
         else
         {
             DropEducationLevel.DataSource = null;
             DropEducationLevel.DataBind();
         }
     }
     catch (Exception ex)
     {
         labelError.Text = CommanClass.ShowMessage("danger", "Danger", ex.Message);
     }
 }