public void BindDll() { try { //For Sub Head Categories using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "select SubHeadCategoriesID,SubHeadCategoriesName from SubHeadCategories"; cmd.Connection = con; con.Open(); DataTable dtSbHdcat = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dtSbHdcat); DDL_AccCde.DataSource = dtSbHdcat; DDL_AccCde.DataTextField = "SubHeadCategoriesName"; DDL_AccCde.DataValueField = "SubHeadCategoriesID"; DDL_AccCde.DataBind(); DDL_AccCde.Items.Add(new ListItem("--Select--", "0")); con.Close(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); //lbl_Heading.Text = "Error!"; lblalert.Text = ex.Message; } }
public void BindDll() { try { //For Sub Head Categories using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "select SubHeadCategoriesID,SubHeadCategoriesName from SubHeadCategories"; cmd.Connection = con; con.Open(); DataTable dtSbHdcat = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dtSbHdcat); DDL_AccCde.DataSource = dtSbHdcat; DDL_AccCde.DataTextField = "SubHeadCategoriesName"; DDL_AccCde.DataValueField = "SubHeadCategoriesID"; DDL_AccCde.DataBind(); DDL_AccCde.Items.Add(new ListItem("--Select--", "0")); con.Close(); } //For Payment To using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "select rtrim('[' + CAST(ven_id AS VARCHAR(200)) + ']-' + ven_nam ) as [ven_nam], ven_id from t_ven where IsActive = '1'"; cmd.Connection = con; con.Open(); DataTable dtPayTo = new DataTable(); SqlDataAdapter adp = new SqlDataAdapter(cmd); adp.Fill(dtPayTo); DDL_Payto.DataSource = dtPayTo; DDL_Payto.DataTextField = "ven_nam"; DDL_Payto.DataValueField = "ven_id"; DDL_Payto.DataBind(); DDL_Payto.Items.Add(new ListItem("--Select--", "0")); con.Close(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); //lbl_Heading.Text = "Error!"; lblalert.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { ShwCRVId(); FillGrid(); TBCRVDat.Text = DateTime.Now.ToShortDateString(); chk_Act.Checked = true; chk_prtd.Checked = true; DDL_AccCde.Focus(); BindDll(); pnlitno.Visible = false; } }