private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { objOrder = new tblOrder(); objDataTable = objOrder.LoadGridData(ddlFields.SelectedValue, txtSearch.Text.Trim()); //'Reset PageIndex of gridviews if (IsResetPageIndex) { if (dgvGridView.PageCount > 0) { dgvGridView.PageIndex = 0; } } dgvGridView.DataSource = null; dgvGridView.DataBind(); lblCount.Text = 0.ToString(); hdnSelectedIDs.Value = ""; //'Check for data into datatable if (objDataTable.Rows.Count <= 0) { DInfo.ShowMessage("No data found", Enums.MessageType.Information); return; } else { if (ddlPerPage.SelectedItem.Text.ToLower() == "all") { dgvGridView.AllowPaging = false; } else { dgvGridView.AllowPaging = true; dgvGridView.PageSize = Convert.ToInt32(ddlPerPage.SelectedItem.Text); } lblCount.Text = objDataTable.Rows.Count.ToString(); objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvGridView.DataSource = objDataTable; dgvGridView.DataBind(); } objOrder = null; }