Пример #1
0
 /* Function use to bind all data to grid*/
 public void BindData()
 {
     try
     {
         Global    ObjSuggest = new Global();
         DataSet   ds         = new DataSet();
         DataTable dt         = new DataTable();
         DataView  dv         = new DataView();
         ds = ObjSuggest.GetTopSuggestion();
         if (ds.Tables[0].Rows.Count > 0)
         {
             GrdSuggestion.Visible = true;
             dt = ds.Tables[0];
             dv = dt.DefaultView;
             if ((SortExpression != string.Empty) && (SortDirection != string.Empty))
             {
                 dv.Sort = SortExpression + " " + SortDirection;
             }
             GrdSuggestion.DataSource = dv;
             GrdSuggestion.DataBind();
             Utility.Setserial(GrdSuggestion, "srno");
             lblNorec.Visible      = false;
             lnkSuggestion.Visible = true;
         }
         else
         {
             lnkSuggestion.Visible = false;
             lblNorec.Visible      = true;
             GrdSuggestion.Visible = false;
         }
     }
     catch  { }
 }
Пример #2
0
    /* Function use to bind all data to grid*/
    public void Bind()
    {
        Global    ObjSuggest = new Global();
        DataSet   ds         = new DataSet();
        DataTable dt         = new DataTable();
        DataView  dv         = new DataView();

        //ds = ObjSuggest.GetAllSuggestion();
        ds = ObjSuggest.GetAllSuggestion(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)
        {
            GrdSuggestion.Visible = true;
            btnDelete.Visible     = true;
            dt = ds.Tables[0];
            dv = dt.DefaultView;
            if ((SortExpression != string.Empty) && (SortDirection != string.Empty))
            {
                dv.Sort = SortExpression + " " + SortDirection;
            }

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

            ErrMessage("Sorry, No records found.");
        }
    }