public void BindGrid() { try { SetDefaultStatus(); int rowcount = ucCustomPager1.isCountRecord; DataTable dtStatus = ChkStatus(); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = oBLL_CP.Get_Charter_Party_List_Search(UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), ddlSupplierList.SelectedValue, dtStatus, sortbycoloumn, sortdirection, ucCustomPager1.CurrentPageIndex, ucCustomPager1.PageSize, ref rowcount); if (ucCustomPager1.isCountRecord == 1) { ucCustomPager1.CountTotalRec = rowcount.ToString(); ucCustomPager1.BuildPager(); } //if (dt.Rows.Count > 0) //{ gvCPList.DataSource = dt; gvCPList.DataBind(); //} } catch { } }