Beispiel #1
0
    /* This function is use to bind all data of GetReferalSource() from database */
    private void BindGrid()
    {
        StoreFront ObjStoreFront = new StoreFront();
        DataSet    ds            = new DataSet();
        DataTable  dt            = new DataTable();
        DataView   dv            = new DataView();

        ds = ObjStoreFront.GetReferalSource(Request.QueryString["SearchFor"].ToString(), Request.QueryString["SearchText"].ToString());
        ddlSearch.SelectedValue = Request.QueryString["SearchFor"].ToString();
        txtSearch.Text          = Request.QueryString["SearchText"].ToString();
        if (ds.Tables[0].Rows.Count > 0)
        {
            gdvReferalSource.Visible = true;
            btnDelete.Visible        = true;
            btnStatus.Visible        = true;
            //lblNorec.Visible = false;
            dt = ds.Tables[0];
            dv = dt.DefaultView;
            if ((SortExpression != string.Empty) && (SortDirection != string.Empty))
            {
                dv.Sort = SortExpression + " " + SortDirection;
            }

            gdvReferalSource.DataSource = dv;
            gdvReferalSource.DataBind();
            CheckAll();
            check();
            Utility.Setserial(gdvReferalSource, "srno");
            divsearch.Visible = true;
        }
        else
        {
            divsearch.Visible = false;
            //lblNorec.Visible = true;
            btnDelete.Visible        = false;
            btnNew.Visible           = true;
            btnStatus.Visible        = false;
            gdvReferalSource.Visible = false;
            ErrMessage("Sorry, No Referral Source found.");
            if ((Convert.ToInt32(ddlSearch.SelectedIndex) > 0) && (txtSearch.Text != ""))
            {
                txtSearch.Text          = "";
                ddlSearch.SelectedIndex = 0;
                lnkNorec.Visible        = true;
                btnNew.Visible          = false;
                // btnAdd.Visible = false;
                // btnExport.Visible = false;
                //lblMsg.Visible = true;
                ErrMessage("Sorry, No Referral Source found.");
            }
        }
    }