private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { tblSubOrder objSubOrder = new tblSubOrder(); objDataTable = objSubOrder.GetDashBoradOrder(ddlFields.SelectedValue, txtSearch.Text.Trim(), Convert.ToInt32(Enums.Enums_OrderStatus.Ordered).ToString(), GetCurrentDateTime()); //'Reset PageIndex of gridviews if (IsResetPageIndex) { if (dgvSubOrder.PageCount > 0) { dgvSubOrder.PageIndex = 0; } } dgvSubOrder.DataSource = null; dgvSubOrder.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 (ddlSubOrderPerPage.SelectedItem.Text.ToLower() == "all") { dgvSubOrder.AllowPaging = false; } else { dgvSubOrder.AllowPaging = true; dgvSubOrder.PageSize = Convert.ToInt32(ddlSubOrderPerPage.SelectedItem.Text); } lblCount.Text = objDataTable.Rows.Count.ToString(); objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvSubOrder.DataSource = objDataTable; dgvSubOrder.DataBind(); } objSubOrder = null; }