private void Page_Load(object sender, System.EventArgs e) { string Language = "en-US"; if (Request.UserLanguages.Length != 0) { Language = Request.UserLanguages[0]; } CurrentUserCulture = System.Globalization.CultureInfo.CreateSpecificCulture(Language); if (ConfigurationSettings.AppSettings["OlymarsDemo ConnectionString"] != null) { ConnectionString = ConfigurationSettings.AppSettings["OlymarsDemo ConnectionString"]; } else if (Application["ConnectionString"] != null) { ConnectionString = Application["ConnectionString"].ToString().Trim(); } if (!Page.IsPostBack) { // Any sort preferences? CurrentSortEnum sortColumn = CurrentSortEnum.SortBy_Cat_StrName; if (Request.Params["SortBy"] != String.Empty) { try { sortColumn = (CurrentSortEnum)Enum.Parse(typeof(CurrentSortEnum), "SortBy_" + Request.Params["SortBy"]); } catch { // Ignore the parameter and do nothing here } } SortOrderEnum sortOrder = SortOrderEnum.Ascending; if (Request.Params["SortOrder"] != String.Empty) { try { sortOrder = (SortOrderEnum)Enum.Parse(typeof(SortOrderEnum), Request.Params["SortOrder"]); } catch { // Ignore the parameter and do nothing here } } if (ViewState["WebFormList_tblCategory_CurrentSort"] == null) { ViewState.Add("WebFormList_tblCategory_CurrentSort", sortColumn); } else { ViewState["WebFormList_tblCategory_CurrentSort"] = sortColumn; } if (ViewState["sortOrder"] == null) { ViewState.Add("sortOrder", sortOrder); } else { ViewState["sortOrder"] = sortOrder; } } repeater_tblCategory_SelectDisplay.EnableViewState = true; RefreshList(); }
private void Page_Load(object sender, System.EventArgs e) { string Language = "en-US"; if (Request.UserLanguages.Length != 0) { Language = Request.UserLanguages[0]; } CurrentUserCulture = System.Globalization.CultureInfo.CreateSpecificCulture(Language); if (ConfigurationSettings.AppSettings["OlymarsDemo ConnectionString"] != null) { ConnectionString = ConfigurationSettings.AppSettings["OlymarsDemo ConnectionString"]; } else if (Application["ConnectionString"] != null) { ConnectionString = Application["ConnectionString"].ToString().Trim(); } if (!Page.IsPostBack) { // com_Pro_LngCategoryID System.Data.SqlTypes.SqlInt32 colPro_LngCategoryID = System.Data.SqlTypes.SqlInt32.Null; if (Request.Params["Pro_LngCategoryID"] != String.Empty) { try { colPro_LngCategoryID = System.Data.SqlTypes.SqlInt32.Parse(Request.Params["Pro_LngCategoryID"]); } catch { // Ignore the parameter and do nothing here } } com_Pro_LngCategoryID.Initialize(ConnectionString); try { com_Pro_LngCategoryID.RefreshData(colPro_LngCategoryID); } catch (OlymarsDemo.DataClasses.CustomException customException) { if (customException.Parameter.SqlException != null) { throw new Exception(String.Format("An exception has been thrown in the underlying DataClass that is used by the 'WebDropDownList_tblCategory' class. Exception message is: {0}", customException.Parameter.SqlException.Message), customException); } else if (customException.Parameter.OtherException != null) { throw new Exception(String.Format("An exception has been thrown in the underlying DataClass that is used by the 'WebDropDownList_tblCategory' class. Exception message is: {0}", customException.Parameter.OtherException.Message), customException); } else { throw; } } com_Pro_LngCategoryID.Items.Insert(0, "Show all"); // Any sort preferences? CurrentSortEnum sortColumn = CurrentSortEnum.SortBy_Pro_StrName; if (Request.Params["SortBy"] != String.Empty) { try { sortColumn = (CurrentSortEnum)Enum.Parse(typeof(CurrentSortEnum), "SortBy_" + Request.Params["SortBy"]); } catch { // Ignore the parameter and do nothing here } } SortOrderEnum sortOrder = SortOrderEnum.Ascending; if (Request.Params["SortOrder"] != String.Empty) { try { sortOrder = (SortOrderEnum)Enum.Parse(typeof(SortOrderEnum), Request.Params["SortOrder"]); } catch { // Ignore the parameter and do nothing here } } if (ViewState["WebFormList_tblProduct_CurrentSort"] == null) { ViewState.Add("WebFormList_tblProduct_CurrentSort", sortColumn); } else { ViewState["WebFormList_tblProduct_CurrentSort"] = sortColumn; } if (ViewState["sortOrder"] == null) { ViewState.Add("sortOrder", sortOrder); } else { ViewState["sortOrder"] = sortOrder; } } repeater_tblProduct_SelectDisplay.EnableViewState = true; RefreshList(); }