Пример #1
0
        protected void ddlApprovVwClerk_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int intApprove = -1;
                if (ddlApprovVwClerk.SelectedItem.Text != "--Select--")
                {
                    intApprove = int.Parse(ddlApprovVwClerk.SelectedItem.Value);
                }
                else
                {
                    GdVwViewClerk.DataSource = null;
                    GdVwViewClerk.DataBind();
                }
                string strClerkName = ddlClerk.SelectedItem.Text;

                if (ddlClerk.SelectedItem.Text == "--Select--" && ddlApprovVwClerk.SelectedItem.Text != "--Select--")
                {
                    BLClerk blpr = new BLClerk();
                    SqlDataReader dr = blpr.gridFillApproveClerk1(intApprove);
                    DataTable dt = new DataTable();
                    if (dr.HasRows)
                    {
                        dt.Load(dr);
                        GdVwViewClerk.DataSource = dt;
                        GdVwViewClerk.DataBind();
                    }
                    else
                    {
                        lblErrorMsg.Text = "Records not found";
                        GdVwViewClerk.DataSource = null;
                        GdVwViewClerk.DataBind();
                    }
                    dr.Close();
                }
                if (ddlClerk.SelectedItem.Text != "--Select--" && ddlApprovVwClerk.SelectedItem.Text != "--Select--")
                {
                    BLClerk blpr = new BLClerk();
                    SqlDataReader dr = blpr.gridFillApproveClerkName1(strClerkName, intApprove);
                    DataTable dt = new DataTable();
                    if (dr.HasRows)
                    {
                        dt.Load(dr);
                        GdVwViewClerk.DataSource = dt;
                        GdVwViewClerk.DataBind();
                    }
                    else
                    {
                        lblErrorMsg.Text = "Records not found";
                        GdVwViewClerk.DataSource = null;
                        GdVwViewClerk.DataBind();
                    }
                    dr.Close();
                }
            }
            catch (Exception ex)
            {
                lblCatchError.Text = ex.Message.ToString();
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if ((HttpContext.Current.Session["LoginId"]) == null)
                {
                    Response.Redirect("~/Login.aspx");
                }

                if (!Page.IsPostBack)
                {
                    BLClerk blsr = new BLClerk();
                    SqlDataReader dr = blsr.getClerkName1();
                    ddlClerk.Items.Clear();
                    ddlClerk.Items.Insert(0, new ListItem("--Select--", "-1"));
                    if (dr.HasRows)
                    {
                        while (dr.Read())
                            ddlClerk.Items.Add(dr.GetString(1));
                    }
                    else
                    {
                        lblErrorMsg.Text = "Records not available";
                        fillgrid();
                    }
                    fillgrid();
                    dr.Close();
                }
                else
                {
                    lblCatchError.Text = "";
                    lblErrorMsg.Text = "";
                }

            }
            catch (Exception ex)
            {
                lblCatchError.Text = ex.Message.ToString();
            }
        }