示例#1
0
    /* Uae to bind data from database admin dont have facility to edit this message */
    private void BindGrid()
    {
        StoreFront ObjStoreFront = new StoreFront();
        DataSet    ds            = new DataSet();
        DataTable  dt            = new DataTable();
        DataView   dv            = new DataView();

        //ds = ObjStoreFront.GetAllContactus();
        ds = ObjStoreFront.GetAllContactus(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)
        {
            btnDelete.Visible    = true;
            gdvContactUs.Visible = true;

            dt = ds.Tables[0];
            dv = dt.DefaultView;
            if ((SortExpression != string.Empty) && (SortDirection != string.Empty))
            {
                dv.Sort = SortExpression + " " + SortDirection;
            }
            gdvContactUs.DataSource = dv;
            gdvContactUs.DataBind();
            CheckAll();
            check();
            Utility.Setserial(gdvContactUs, "srno");
            divsearch.Visible = true;
        }
        else
        {
            if ((Convert.ToInt32(ddlSearch.SelectedIndex) > 0) && (txtSearch.Text != ""))
            {
                txtSearch.Text          = "";
                ddlSearch.SelectedIndex = 0;
                lnkNorec.Visible        = true;
                ErrMessage("Sorry no records found.");
            }
            divsearch.Visible    = false;
            btnDelete.Visible    = false;
            gdvContactUs.Visible = false;
            ErrMessage("Sorry no records found.");
        }
    }