Esempio n. 1
0
 private void SortRecords(string sortExpression, string direction)
 {
     try
     {
         DataView dv = new DataView();
         dv = new DataView(JobDTearch);
         if (dv.Count > 0)
         {
             if (string.IsNullOrEmpty(sortExpression))
             {
                 sortExpression = JobDTearch.Columns[1].ToString();
                 dv.Sort        = sortExpression;
             }
             else
             {
                 dv.Sort        = sortExpression + " " + direction;
                 GDV.DataSource = dv;
             }
         }
         else
         {
             GDV.DataSource = null;
         }
         GDV.DataBind();
     }
     catch (Exception ex)
     {
     }
 }
        public void BindGridView(int pageNo)
        {
            int pageSize = 15;

            GDV.PageSize = pageSize;

            try
            {
                string sQuery = "sp_GetProductByCustomPaging '" + pageNo + "','" + pageSize + "','" + Session["DealerCode"].ToString() + "', 'P'";

                if (objMBL.ExecuteQuery(sQuery, ref ds))
                {
                    Session["Parts"]     = ds;
                    GDV.VirtualItemCount = Convert.ToInt32(ds.Tables[1].Rows[0]["Total"]);
                    GDV.DataSource       = ds.Tables[0];
                    GDV.DataBind();
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            finally
            {
            }
        }
        public void GetDSdata(DataTable dt, string field)
        {
            var results = from myRow in dt.AsEnumerable()
                          where myRow.Field <string>(field).ToUpper().StartsWith(txtSearch.Text.ToUpper())
                          select myRow;
            DataView view = results.AsDataView();

            GDV.DataSource = view;
            GDV.DataBind();
        }
Esempio n. 4
0
 private void bindMasters()
 {
     try
     {
         SqlParameter[] prm = { new SqlParameter("@action", "all") };
         DataSet        ds  = clsSQLExecute.Exec_Dataset_sp("Get_ProjectMaster", prm);
         GDV.DataSource = ds;
         GDV.DataBind();
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 5
0
    protected void lbl_ANM_Click(object sender, EventArgs e)
    {
        string  id  = Session["emp_id"].ToString();
        string  sql = "select * from Raised_request where Status='Approved by NM'and emp_id='" + id + "'";
        DataSet ds  = new DataSet();

        ds             = DAL.SqlHelper.ExecuteDataset(clsConnection.Connection, CommandType.Text, sql);
        GDV.DataSource = ds;
        GDV.DataBind();
        GDV.Visible      = true;
        lbl_home.Visible = true;
        lbl_home.Text    = "Number of Requests Approved by Network Manager ...";
    }
Esempio n. 6
0
        protected void getDataWithSP()
        {
            //string sQuery;

            //sQuery = "SP_SelectParts '" + Session["DealerCode"].ToString() + "', 'P'";

            //if (objMBL.ExecuteQuery(sQuery, ref ds))
            //{
            //    GDV.DataSource = ds;
            //    GDV.DataBind();
            //}

            GDV.DataSource = (DataSet)Session["Parts"];
            GDV.DataBind();
            Session["SearchParts"] = (DataSet)Session["Parts"];
            //GDV.HeaderRow.TableSection = TableRowSection.TableHeader;
        }
 private void bindData()
 {
     try
     {
         SqlConnection con     = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myconnection"].ToString());
         SqlCommand    command = new SqlCommand("Get_Registration", con);
         command.CommandType = System.Data.CommandType.StoredProcedure;
         command.Parameters.Add(new SqlParameter("@action", "all"));
         con.Open();
         DataTable dt = new DataTable();
         dt.Load(command.ExecuteReader());
         GDV.DataSource          = dt;
         GDV.AutoGenerateColumns = true;
         GDV.DataBind();
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 8
0
    protected void Button1_Click2(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString);

        con.Open();

        String show1 = "select id,name,gender,age,profession,organisation,mobile,bloodgroup,area,complexity,email from doner  where bloodgroup='" + Bld.Text + "'";

        SqlCommand com1 = new SqlCommand(show1, con);

        SqlDataReader rdr = com1.ExecuteReader();

        GDV.DataSource = rdr;
        GDV.DataBind();
        con.Close();
        string variable1 = "Your Searching is Successfull.";

        ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + variable1 + "');", true);
    }
Esempio n. 9
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtSearch.Text.Trim() != "")
         {
             getData();
         }
         else
         {
             Session["SearchParts"] = null;
             GDV.AllowPaging        = true;
             GDV.PageSize           = 15;
             GDV.DataSource         = (DataSet)Session["Parts"];
             GDV.DataBind();
         }
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }
Esempio n. 10
0
        protected void btnClear_Click(object sender, EventArgs e)
        {
            try
            {
                txtSearch.Text = "";

                if (LookUpPageId == 10)
                {
                    Session["SearchParts"] = null;
                    GDV.AllowPaging        = true;
                    GDV.PageSize           = 15;
                    GDV.DataSource         = (DataSet)Session["Parts"];
                    GDV.DataBind();
                }
                else
                {
                    getData();
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = ex.Message;
            }
        }
Esempio n. 11
0
 private void ListarDados()
 {
     GDV.DataSource = new Controller().Select();
     GDV.DataBind();
 }
Esempio n. 12
0
        protected void getData()
        {
            ColumnsName = Session["ColumnsName"].ToString();
            AppendWhere = Session["AppendInWhere"].ToString();
            if (Session["AppendOrderby"] != null)
            {
                AppendOrderby = Session["AppendOrderby"].ToString();
            }
            if (Request.QueryString["Grp"] != null)
            {
                AppendInGroupBy = Request.QueryString["Grp"].ToString();
            }
            string sQuery;

            if (LookUpPageId.ToString() != string.Empty)
            {
                clsLookUp clp = new clsLookUp();
                if (AppendInGroupBy != string.Empty)
                {
                    if (txtSearch.Text != string.Empty)
                    {
                        if (AppendWhere != string.Empty)
                        {
                            sQuery = ColumnsName + " Where " + AppendWhere + " and " +
                                     rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy;
                        }
                        else
                        {
                            sQuery = ColumnsName + " Where " +
                                     rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy;
                        }
                    }
                    else
                    {
                        if (AppendWhere != string.Empty)
                        {
                            sQuery = ColumnsName + " Where " + AppendWhere + " " + AppendInGroupBy;
                        }
                        else
                        {
                            sQuery = ColumnsName + " " + AppendInGroupBy;
                        }
                    }
                }
                else
                {
                    if (txtSearch.Text != string.Empty)
                    {
                        if (AppendWhere != string.Empty)
                        {
                            sQuery = ColumnsName + " Where " + AppendWhere + " and " +
                                     rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'";
                        }
                        else
                        {
                            sQuery = ColumnsName + " Where " +
                                     rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'";
                        }
                    }
                    else
                    {
                        if (AppendWhere != string.Empty)
                        {
                            sQuery = ColumnsName + " Where " + AppendWhere;
                        }
                        else
                        {
                            sQuery = ColumnsName;
                        }
                    }
                }
                if (AppendOrderby != string.Empty)
                {
                    sQuery = sQuery + " " + AppendOrderby;
                }


                if (txtSearch.Text == string.Empty)
                {
                    if (sysfuns.ExecuteQuery(sQuery, ref ds))
                    {
                        GDV.AllowPaging = true;
                        GDV.PageSize    = 15;
                        //Session["Parts"] = ds;
                        Session["SearchParts"] = ds;
                        GDV.DataSource         = ds;
                        GDV.DataBind();

                        //GDV.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                }
                else
                {
                    if (sysfuns.ExecuteQuery(sQuery, ref ds))
                    {
                        GDV.AllowPaging = false;
                        //GDV.PageSize = 15;
                        //Session["Parts"] = ds;
                        Session["SearchParts"] = ds;
                        GDV.DataSource         = ds;
                        GDV.DataBind();

                        //GDV.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                }
            }
        }
Esempio n. 13
0
        protected void getData()
        {
            ColumnsName = Session["ColumnsName"].ToString();
            AppendWhere = Session["AppendInWhere"].ToString();
            if (Session["AppendOrderby"] != null)
            {
                AppendOrderby = Session["AppendOrderby"].ToString();
            }
            if (Request.QueryString["Grp"] != null)
            {
                AppendInGroupBy = Request.QueryString["Grp"].ToString();
            }
            string sQuery;

            if (LookUpPageId.ToString() != string.Empty)
            {
                clsLookUp clp = new clsLookUp();
                if (AppendInGroupBy != string.Empty)
                {
                    if (txtSearch.Text != string.Empty)
                    {
                        if (AppendWhere != string.Empty)
                        {
                            sQuery = ColumnsName + " Where " + AppendWhere + " and " +
                                     rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy;
                        }
                        else
                        {
                            sQuery = ColumnsName + " Where " +
                                     rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%' " + AppendInGroupBy;
                        }
                    }
                    else
                    {
                        if (AppendWhere != string.Empty)
                        {
                            sQuery = ColumnsName + " Where " + AppendWhere + " " + AppendInGroupBy;
                        }
                        else
                        {
                            sQuery = ColumnsName + " " + AppendInGroupBy;
                        }
                    }
                }
                else
                {
                    if (txtSearch.Text != string.Empty)
                    {
                        if (AppendWhere != string.Empty)
                        {
                            sQuery = ColumnsName + " Where " + AppendWhere + " and " +
                                     rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'";
                        }
                        else
                        {
                            sQuery = ColumnsName + " Where " +
                                     rdblColumns.SelectedValue.ToString() + " like '%" + txtSearch.Text.Trim() + "%'";
                        }
                    }
                    else
                    {
                        if (AppendWhere != string.Empty)
                        {
                            sQuery = ColumnsName + " Where " + AppendWhere;
                        }
                        else
                        {
                            sQuery = ColumnsName;
                        }
                    }
                }
                if (AppendOrderby != string.Empty)
                {
                    sQuery = sQuery + " " + AppendOrderby;
                }

                if (LookUpPageId == 75)
                {
                    string CCon = CConnection.GetConnStringForAccount();

                    ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, sQuery);
                    GDV.AllowPaging = false;
                    GDV.PageSize    = ds.Tables[0].Rows.Count;
                    //Session["Parts"] = ds;
                    //Session["SearchParts"] = ds;
                    GDV.DataSource = ds;
                    GDV.DataBind();
                }
                else
                {
                    if (objMBL.ExecuteQuery(sQuery, ref ds))
                    {
                        GDV.AllowPaging = true;
                        GDV.PageSize    = 15;
                        //Session["Parts"] = ds;
                        Session["SearchParts"] = ds;
                        GDV.DataSource         = ds;
                        GDV.DataBind();

                        //GDV.HeaderRow.TableSection = TableRowSection.TableHeader;
                    }
                }
            }
        }