Beispiel #1
0
        protected void LinkBtnExportExcel_Click(object sender, EventArgs e)
        {
            try
            {
                System.Threading.Thread.Sleep(2000);
                Response.Clear();
                Response.Buffer = true;
                Response.ClearContent();
                Response.ClearHeaders();
                Response.Charset = "";
                string         FileName       = "SupplierList.xls";
                StringWriter   strwritter     = new StringWriter();
                HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.ContentType = "application/vnd.ms-excel";
                Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
                GVSupplier.GridLines             = GridLines.Both;
                GVSupplier.HeaderStyle.Font.Bold = true;

                GVSupplier.RenderControl(htmltextwrtter);

                Response.Write(strwritter.ToString());
                Response.End();
            }
            catch (Exception ex)
            {
                //   throw;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                lblalert.Text = ex.Message;
            }
        }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        lblCid.Text = "1000";

        objSqlcon = new SqlConnection("Data Source=LG-PC\\SQLEXPRESS;Initial Catalog=pnl;Integrated Security=True");
        string query = "select * from Party where Ptype='customer'and CompanyId=" + lblCid.Text + "";

        objSqlDa = new SqlDataAdapter(query, objSqlcon);
        objDT    = new DataTable();
        objSqlDa.Fill(objDT);
        GVSupplier.DataSource = objDT;
        GVSupplier.DataBind();
    }
Beispiel #3
0
    private void gridbind()
    {
        String cid = Session["Cid"].ToString();

        objSqlcon = new SqlConnection("Data Source=LG-PC\\SQLEXPRESS;Initial Catalog=pnl;Integrated Security=True");
        string query = "select * from Stock where CompanyId=" + cid + "";

        objSqlDa = new SqlDataAdapter(query, objSqlcon);
        objDT    = new DataTable();
        objSqlDa.Fill(objDT);
        GVSupplier.DataSource = objDT;
        GVSupplier.DataBind();
    }
Beispiel #4
0
        public void FillGrid()
        {
            try
            {
                dt_ = new DataTable();
                dt_ = DBConnection.GetQueryData(" select * from supplier where CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "' order by supplierId desc");

                GVSupplier.DataSource = dt_;
                GVSupplier.DataBind();
                ViewState["Supplier"] = dt_;
            }
            catch (Exception ex)
            {
                //throw;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                lblalert.Text = ex.Message;
            }
        }
Beispiel #5
0
        protected void TBSearch_TextChanged(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(2000);
            try
            {
                FillGrid();
                DataTable _dt = (DataTable)ViewState["Supplier"];
                DataView  dv  = new DataView(_dt, "suppliername LIKE '%" + TBSearch.Text.Trim().ToUpper() + "%'", "[suppliername] ASC", DataViewRowState.CurrentRows);
                DataTable dt_ = new DataTable();
                dt_ = dv.ToTable();

                GVSupplier.DataSource = dt_;
                GVSupplier.DataBind();
                TBSearch.Text = "";
            }
            catch (Exception ex)
            {
                //   throw;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                lblalert.Text = ex.Message;
            }
        }