private void SearchRecord() { try { if (TBSearchDebtNot.Text != "") { DataTable dt_po = new DataTable(); string queryString = " select distinct(tbl_Mdn.Mdn_id),Mdn_dat,tbl_Mdn.CreatedBy,tbl_Mdn.CreatedAt,tbl_Mdn.ISActive,SubHeadCategoriesName as [CustomerName] from tbl_Mdn " + " inner join tbl_Ddn on tbl_Mdn.Mdn_id = tbl_Ddn.Mdn_id " + " inner join SubHeadCategories on tbl_Mdn.custacc = SubHeadCategories.SubHeadCategoriesGeneratedID where tbl_Mdn.Mdn_id='" + TBSearchDebtNot.Text.Trim() + "' and tbl_Mdn.ISActive = '1'" + // and" + //" tbl_Mdn.CompanyId = '" + Session["CompanyID"] + "' and tbl_Mdn.BranchId= '" + Session["BranchID"] + "'" + " order by tbl_Mdn.Mdn_id desc "; dt_po = DBConnection.GetQueryData(queryString); GVScrhMDN.DataSource = dt_po; GVScrhMDN.DataBind(); } else if (TBSearchDebtNot.Text == "") { FillGrid(); } } catch (Exception) { throw; } }
public void FillGrid() { try { DataTable dt_ = new DataTable(); query = " select distinct(tbl_Mdn.Mdn_id),Mdn_dat,tbl_Mdn.CreatedBy,tbl_Mdn.CreatedAt,tbl_Mdn.ISActive,SubHeadCategoriesName as [CustomerName] from tbl_Mdn inner join tbl_Ddn on tbl_Mdn.Mdn_id = tbl_Ddn.Mdn_id " + " inner join SubHeadCategories on tbl_Mdn.CustomerID = SubHeadCategories.SubHeadCategoriesGeneratedID where tbl_Mdn.ISActive = '1' " + " order by tbl_Mdn.Mdn_id desc "; dt_ = DBConnection.GetQueryData(query); GVScrhMDN.DataSource = dt_; GVScrhMDN.DataBind(); ViewState["GetMDN"] = dt_; } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = ex.Message; } }