protected void DDLQuestionType_SelectedIndexChanged(object sender, EventArgs e) { try { ds = cn.RunSql("usp_GetComboList 'QuestionHeading','" + DDLQuestionType.SelectedValue + "','" + Request.Cookies["compid"].Value + "'", "s"); DDLQuestionheading.DataSource = ds; DDLQuestionheading.DataBind(); } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["loginid"].Value == "") { Response.Redirect("login.aspx"); } DDLMedium.Focus(); if (Session["Msg"] != null) { lblsucess.Text = Session["Msg"].ToString(); divsucess.Visible = true; Session["Msg"] = null; } try { if (IsPostBack == false) { ds = cn.RunSql("usp_GetComboList 'Medium','','" + Request.Cookies["compid"].Value + "'", "s"); DDLMedium.DataSource = ds; DDLMedium.DataBind(); ds = cn.RunSql("usp_GetComboList 'Level','','" + Request.Cookies["compid"].Value + "'", "s"); DDLLevel.DataSource = ds; DDLLevel.DataBind(); if (Request.QueryString["id"] != null) { ds = cn.RunSql("usp_SearchMaster 'QuestionMaster','" + Request.QueryString["id"] + "'", "search"); DDLMedium.SelectedValue = ds.Tables[0].Rows[0]["cMedium_ID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cMedium_ID"].ToString() : ""; DDLLevel.SelectedValue = ds.Tables[0].Rows[0]["cLevel_ID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cLevel_ID"].ToString() : ""; ds1 = cn.RunSql("usp_GetComboList 'Standard','" + DDLMedium.SelectedValue + "','" + Request.Cookies["compid"].Value + "'", "s"); DDLStandard.DataSource = ds1; DDLStandard.DataBind(); DDLStandard.SelectedValue = ds.Tables[0].Rows[0]["cStandard_ID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cStandard_ID"].ToString() : ""; ds1 = cn.RunSql("usp_GetComboList 'Subject','" + DDLStandard.SelectedValue + "','" + Request.Cookies["compid"].Value + "'", "s"); DDLSubject.DataSource = ds1; DDLSubject.DataBind(); DDLSubject.SelectedValue = ds.Tables[0].Rows[0]["cSubject_ID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cSubject_ID"].ToString() : ""; ds1 = cn.RunSql("usp_GetComboList 'Chapter','" + DDLSubject.SelectedValue + "','" + Request.Cookies["compid"].Value + "'", "s"); DDLChapter.DataSource = ds1; DDLChapter.DataBind(); DDLChapter.SelectedValue = ds.Tables[0].Rows[0]["cChapter_ID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cChapter_ID"].ToString() : ""; ds1 = cn.RunSql("usp_GetComboList 'Topic','" + DDLChapter.SelectedValue + "','" + Request.Cookies["compid"].Value + "'", "s"); DDLTopic.DataSource = ds1; DDLTopic.DataBind(); DDLTopic.SelectedValue = ds.Tables[0].Rows[0]["cTopic_ID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cTopic_ID"].ToString() : ""; ds1 = cn.RunSql("usp_GetComboList 'QuestionType','" + DDLSubject.SelectedValue + "','" + Request.Cookies["compid"].Value + "'", "s"); DDLQuestionType.DataSource = ds1; DDLQuestionType.DataBind(); DDLQuestionType.SelectedValue = ds.Tables[0].Rows[0]["cQuestion_Type_ID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cQuestion_Type_ID"].ToString() : ""; ds1 = cn.RunSql("usp_GetComboList 'QuestionHeading','" + DDLQuestionType.SelectedValue + "','" + Request.Cookies["compid"].Value + "'", "s"); DDLQuestionheading.DataSource = ds1; DDLQuestionheading.DataBind(); DDLQuestionheading.SelectedValue = ds.Tables[0].Rows[0]["cQuestion_Heading_ID"] != DBNull.Value ? ds.Tables[0].Rows[0]["cQuestion_Heading_ID"].ToString() : ""; TxtQuestion.Text = ds.Tables[0].Rows[0]["cQuestion"] != DBNull.Value ? ds.Tables[0].Rows[0]["cQuestion"].ToString() : ""; TxtAnswerKey.Text = ds.Tables[0].Rows[0]["cAnswerKey"] != DBNull.Value ? ds.Tables[0].Rows[0]["cAnswerKey"].ToString() : ""; TxtHint.Text = ds.Tables[0].Rows[0]["cHint"] != DBNull.Value ? ds.Tables[0].Rows[0]["cHint"].ToString() : ""; // TxtHeadingName.Text = ds.Tables[0].Rows[0]["cDescription"] != DBNull.Value ? ds.Tables[0].Rows[0]["cDescription"].ToString() : ""; if (Request.QueryString["D"] == "1") { ddldelete.Visible = true; btnsubmit.Text = "Delete"; } } } } catch (Exception ex) { lblerror.Text = ex.Message; diverror.Visible = true; } finally { //ds.Dispose(); //ds1.Dispose(); } }