private void LoadProductDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { objCouponCodeProduct = new tblCouponCodeProduct(); objDataTable = objCouponCodeProduct.LoadGridData(Convert.ToInt32(hdnType.Value), hdnPKID.Value); if (IsResetPageIndex) { if (dgvGridViewProduct.PageCount > 0) { dgvGridViewProduct.PageIndex = 0; } } dgvGridViewProduct.DataSource = null; dgvGridViewProduct.DataBind(); hdnSelectedIDs.Value = ""; if (objDataTable.Rows.Count <= 0) { DinfoBranchGrid.ShowMessage("No data found", Enums.MessageType.Information); return; } else { dgvGridViewProduct.AllowPaging = false; objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvGridViewProduct.DataSource = objDataTable; dgvGridViewProduct.DataBind(); } objCouponCodeProduct = null; }
public void LoadSubCategoryData(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { objSizeSubCategory = new tblSizeSubCategory(); objDataTable = objSizeSubCategory.LoadGridData(hdnPKID.Value, ddlSerachCategory.SelectedValue, ddlSerachSubCategory.SelectedValue); //'Reset PageIndex of gridviews if (IsResetPageIndex) { if (dgvSubCategory.PageCount > 0) { dgvSubCategory.PageIndex = 0; } } dgvSubCategory.DataSource = null; dgvSubCategory.DataBind(); lblSubCategoryCount.Text = 0.ToString(); hdnSelectedIDs.Value = ""; //'Check for data into datatable if (objDataTable.Rows.Count <= 0) { DinfoBranchGrid.ShowMessage("No data found", Enums.MessageType.Information); return; } else { if (ddlSubCategoryPerPage.SelectedItem.Text.ToLower() == "all") { dgvSubCategory.AllowPaging = false; } else { dgvSubCategory.AllowPaging = true; dgvSubCategory.PageSize = Convert.ToInt32(ddlSubCategoryPerPage.SelectedItem.Text); } lblSubCategoryCount.Text = objDataTable.Rows.Count.ToString(); objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvSubCategory.DataSource = objDataTable; dgvSubCategory.DataBind(); } objSizeSubCategory = null; }
protected void btnSubCategoryDelete_Click(object sender, EventArgs e) { string[] arIDs = hdnSelectedIDs.Value.ToString().TrimEnd(',').Split(','); bool IsDelete = false; for (int i = 0; i <= arIDs.Length - 1; i++) { if (!string.IsNullOrEmpty(arIDs.GetValue(i).ToString())) { if (DeleteSubCategory(Convert.ToInt32(arIDs.GetValue(i)))) { IsDelete = true; } } } if (IsDelete) { LoadSubCategoryData(false, false); } DinfoBranchGrid.ShowMessage("Sub Category in size has been deleted successfully", Enums.MessageType.Successfull); hdnSelectedIDs.Value = ""; loadUnselectedSizeGrid(); }