Example #1
0
    public void SortDetailGrid(Object sender, GridViewSortEventArgs e)
    {
        try
        {
            if (hidSort.Attributes["sortType"] != null)
            {
                if (hidSort.Attributes["sortType"].ToString() == "ASC")
                {
                    hidSort.Attributes["sortType"] = "DESC";
                }
                else
                {
                    hidSort.Attributes["sortType"] = "ASC";
                }
            }
            else
            {
                hidSort.Attributes.Add("sortType", "DESC");
            }

            hidSort.Value = e.SortExpression + " " + hidSort.Attributes["sortType"].ToString();

            dt = (DataTable)Session["BSSData"];
            DataView dv = new DataView(dt, hidRowFilter.Value.ToString(), hidSort.Value.ToString(), DataViewRowState.CurrentRows);
            BSSGridView.DataSource = dv;
            BSSGridView.DataBind();
            DetailGridPanel.Height = new Unit(double.Parse(DetailGridHeightHidden.Value), UnitType.Pixel);
            DetailGridPanel.Width  = new Unit(double.Parse(DetailGridWidthHidden.Value), UnitType.Pixel);
        }
        catch (Exception e2)
        {
            lblErrorMessage.Text = "Sort Error " + e2.Message + ", " + e2.ToString();
            MessageUpdatePanel.Update();
        }
    }
Example #2
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        //tPager.Visible = true;
        //BSSGridView.CurrentPageIndex = 0;
        //Pager1.GotoPageNumber = 0;
        //pnlPager.Update();

        lblErrorMessage.Text   = "";
        lblSuccessMessage.Text = "";
        MessageUpdatePanel.Update();

        if (txtBranchNo.Text.Trim().Length == 0)
        {
            lblErrorMessage.Text = "You must enter a Branch Number.";
            MessageUpdatePanel.Update();
        }
        else
        {
            lblErrorMessage.Text = "";
            ClearDisplay();

            //Validate Item Params
            if (string.IsNullOrEmpty(txtStrCat.Text))
            {
                txtStrCat.Text = "00000";
                if (string.IsNullOrEmpty(txtEndCat.Text))
                {
                    txtEndCat.Text = "99999";
                }
            }
            else
            {
                if (string.IsNullOrEmpty(txtEndCat.Text))
                {
                    txtEndCat.Text = txtStrCat.Text;
                }
            }

            if (string.IsNullOrEmpty(txtStrSize.Text))
            {
                txtStrSize.Text = "0000";
                if (string.IsNullOrEmpty(txtEndSize.Text))
                {
                    txtEndSize.Text = "9999";
                }
            }
            else
            {
                if (string.IsNullOrEmpty(txtEndSize.Text))
                {
                    txtEndSize.Text = txtStrSize.Text;
                }
            }

            if (string.IsNullOrEmpty(txtStrVar.Text))
            {
                txtStrVar.Text = "000";
                if (string.IsNullOrEmpty(txtEndVar.Text))
                {
                    txtEndVar.Text = "999";
                }
            }
            else
            {
                if (string.IsNullOrEmpty(txtEndVar.Text))
                {
                    txtEndVar.Text = txtStrVar.Text;
                }
            }

            //Get the data using pSSLocExcelDump
            ds = SqlHelper.ExecuteDataset(cnERP, "pSSLocExcelDump",
                                          new SqlParameter("@LocID", txtBranchNo.Text.Trim()),
                                          new SqlParameter("@StrCat", txtStrCat.Text.Trim()),
                                          new SqlParameter("@StrSize", txtStrSize.Text.Trim()),
                                          new SqlParameter("@StrVar", txtStrVar.Text.Trim()),
                                          new SqlParameter("@EndCat", txtEndCat.Text.Trim()),
                                          new SqlParameter("@EndSize", txtEndSize.Text.Trim()),
                                          new SqlParameter("@EndVar", txtEndVar.Text.Trim()));

            if (ds.Tables.Count >= 1)
            {
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DataView dv = new DataView(dt, hidRowFilter.Value.ToString(), hidSort.Value.ToString(), DataViewRowState.CurrentRows);
                    // BSSGridView.DataSource = dv;
                    lblSuccessMessage.Text = dt.Rows.Count.ToString().Trim() + " record(s) found. Click Excel button to Export";

                    Session["BSSData"] = dt;

                    BSSGridView.DataBind();

                    ExcelUpdatePanel.Visible = true;
                    SelectorUpdatePanel.Update();
                    DetailUpdatePanel.Update();
                }
                else
                {
                    lblErrorMessage.Text = "No Branch Status for Branch Location " + txtBranchNo.Text.Trim();
                    MessageUpdatePanel.Update();
                    Session["BSSData"] = null;
                    BSSGridView.DataBind();
                }
                MessageUpdatePanel.Update();
            }
        }
    }