protected void ddlSection_SelecttedIndexChanged(object sender, EventArgs e) { try { SUB_SECTION_BLL subSectionBll = new SUB_SECTION_BLL(); string OCODE = ((SessionUser)Session["SessionUser"]).OCode; int sectionId = Convert.ToInt16(ddlSection.SelectedValue); var row = subSectionBll.GetSubSectionsBySectionIdAndOCode(sectionId, OCODE).ToList(); if (row.Count > 0) { ddlSubSections.DataSource = row; ddlSubSections.DataTextField = "SUB_SEC_NAME"; ddlSubSections.DataValueField = "SUB_SEC_ID"; ddlSubSections.DataBind(); ddlSubSections.Items.Insert(0, new ListItem("--Select--", "0")); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }