protected void LoadChartOfAccountsHeadList() { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetActiveAndPostedChartOfAccountsHeadList(); accountHeadDropDownList.DataSource = dt; accountHeadDropDownList.DataValueField = "AccountId"; accountHeadDropDownList.DataTextField = "AccountHead"; accountHeadDropDownList.DataBind(); accountHeadDropDownList.Items.Insert(0, ""); accountHeadDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Account Head Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { chartOfAccount = null; } }
protected void LoadChartOfAccountsHeadList() { ChartOfAccountBLL chartOfAccount = new ChartOfAccountBLL(); try { DataTable dt = chartOfAccount.GetActiveAndPostedChartOfAccountsHeadList(); for (int i = 0; i < dt.Rows.Count; i++) { ListItem item1 = new ListItem(dt.Rows[i]["AccountHead"].ToString(), dt.Rows[i]["AccountId"].ToString()); if (dt.Rows[i]["AccountId"].ToString().Contains("A")) { item1.Attributes["OptionGroup"] = "Asset"; } else if (dt.Rows[i]["AccountId"].ToString().Contains("E")) { item1.Attributes["OptionGroup"] = "Expense"; } else if (dt.Rows[i]["AccountId"].ToString().Contains("I")) { item1.Attributes["OptionGroup"] = "Income"; } else if (dt.Rows[i]["AccountId"].ToString().Contains("L")) { item1.Attributes["OptionGroup"] = "Liability"; } // accountHeadDropDownList.Items.Add(item1); } //accountHeadDropDownList.DataSource = dt; //accountHeadDropDownList.DataValueField = "AccountId"; //accountHeadDropDownList.DataTextField = "AccountHead"; //accountHeadDropDownList.DataBind(); // accountHeadDropDownList.Items.Insert(0, ""); //accountHeadDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Account Head Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { chartOfAccount = null; } }