/// <summary> /// Bind Result of search criteria /// </summary> private void BindDataGrid() { whereClause = (isSort && ViewState["whereClause"] != null) ? ViewState["whereClause"].ToString() : whereClause; if (whereClause == "") { whereClause = "SellToCustNo=''"; } if (ddlHeaderType.SelectedValue.Trim().ToLower() == "in" || ddlSearchType.SelectedItem.Value.Trim() == "I") { SOHEADERTABLE = "SOHeaderHist"; } DataTable dsSoFind = sOEFind.GetSalesOrder(whereClause, SOHEADERTABLE); ViewState["dtSOFind"] = dsSoFind; if (dsSoFind != null) { dtSoFind = dsSoFind; if (dtSoFind.Rows.Count == 0) { DataRow dr = dtSoFind.NewRow(); dtSoFind.Rows.Add(dr); } int allowedRowCount = Convert.ToInt32(ViewState["MaxRowCount"].ToString()); if (dtSoFind.Rows.Count < allowedRowCount) { ViewState["whereClause"] = whereClause; dtSoFind.DefaultView.Sort = (hidSort.Value == "") ? "SoNo asc" : hidSort.Value; gvFind.DataSource = dtSoFind.DefaultView.ToTable(); //gvFind.DataBind(); GridPager.InitPager(gvFind, 20); ExportSoFind(); } else { gvFind.DataSource = null; gvFind.DataBind(); utility.DisplayMessage(PFC.SOE.Enums.MessageType.Failure, "Maximum row exceeds for this search.please enter additional data.", lblMessage); //ScriptManager.RegisterClientScriptBlock(ibtnOrderSearch, ibtnOrderSearch.GetType(), "search", "alert('');", true); } gvFind.Visible = true; upSOGrid.Update(); } if (dsSoFind == null || dsSoFind.Rows.Count == 0) { gvFind.DataSource = null;; gvFind.DataBind(); utility.DisplayMessage(PFC.SOE.Enums.MessageType.Success, "No record found", lblMessage); upSOGrid.Update(); upMessage.Update(); } upSOGrid.Update(); upSOSearch.Update(); upMessage.Update(); }