コード例 #1
0
        public void FillGrid()
        {
            try
            {
                DataTable dt_ = new DataTable();
                //dt_ = DBConnection.GetQueryData("select rtrim('[' + CAST(ProductTypeID AS VARCHAR(200)) + ']-' + ProductTypeName ) as [ProductTypeName], ProductTypeID from tbl_branches");
                dt_ = DBConnection.GetQueryData("select tbl_branches.CompanyId, BranchId, tbl_branches.Name as [Branch], tbl_Companies.Name as [Company] from tbl_branches inner join tbl_Companies on tbl_Companies.CompanyId = tbl_branches.CompanyId");

                GVBranch.DataSource = dt_;
                GVBranch.DataBind();
                ViewState["Branch"] = dt_;
            }
            catch (Exception ex)
            {
                //   throw;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
                lblalert.Text = ex.Message;
            }
        }
コード例 #2
0
 private void SearchRecord()
 {
     try
     {
         FillGrid();
         DataTable _dt = (DataTable)ViewState["Branch"];
         DataView  dv  = new DataView(_dt, "Name LIKE '%" + TBSearchBranch.Text.Trim().ToUpper() + "%'", "[Name] ASC", DataViewRowState.CurrentRows);
         DataTable dt_ = new DataTable();
         dt_ = dv.ToTable();
         GVBranch.DataSource = dt_;
         GVBranch.DataBind();
         ViewState["Branch"] = dt_;
     }
     catch (Exception ex)
     {
         //   throw;
         ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true);
         lblalert.Text = ex.Message;
     }
 }