public void BindUserGrid() { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = objUserBLL.Get_UserList_Search(txtfilter.Text != "" ? txtfilter.Text : null , UDFLib.ConvertIntegerToNull(ddlCompanyFilter.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlDepartmentFilter.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlManagerFilter.SelectedValue), null, UDFLib.ConvertStringToNull(ddlUserTypeFilter.SelectedValue), null, sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (dt.Rows.Count > 0) { GridViewUsers.DataSource = dt; GridViewUsers.DataBind(); } else { GridViewUsers.DataSource = dt; GridViewUsers.DataBind(); } }