private void Page_Load(object sender, System.EventArgs e) { try { // 01/08/2006 Paul. The viewstate is no longer disabled, so we can go back to using ctlSearch.NAME. string sNAME = ctlSearch.NAME; //Sql.ToString(Request[ctlSearch.ListUniqueID]); ctlSearch.Visible = Sql.IsEmptyString(sNAME); ctlLayoutButtons.Visible = !ctlSearch.Visible; DataTable dtFields = null; if (!Sql.IsEmptyString(sNAME) && sNAME != Sql.ToString(ViewState["LAYOUT_VIEW_NAME"])) { // 01/08/2006 Paul. We are having a problem with the ViewState not loading properly. // This problem only seems to occur when the NewRecord is visible and we try and load a different view. // The solution seems to be to hide the Search dialog so that the user must Cancel out of editing the current view. // This works very well to clear the ViewState because we GET the next page instead of POST to it. Utils.SetPageTitle(Page, sNAME); Page.DataBind(); tblMain.EnableViewState = false; string sMODULE_NAME = String.Empty; string sVIEW_NAME = String.Empty; GetModuleName(sNAME, ref sMODULE_NAME, ref sVIEW_NAME); dtFields = GetLayoutFields(sNAME).Copy(); ViewState["MODULE_NAME"] = sMODULE_NAME; ViewState["VIEW_NAME"] = sVIEW_NAME; ViewState["LAYOUT_VIEW_NAME"] = sNAME; ViewState["dtFields"] = dtFields; if (dtFields.Rows.Count > 0) { ViewState["ROW_MINIMUM"] = dtFields.Rows[0][LayoutIndexName()]; } else { ViewState["ROW_MINIMUM"] = 0; } } else { dtFields = ViewState["dtFields"] as DataTable; } ctlNewRecord = ctlHeader.FindControl("ctlNewRecord") as NewRecord; if (ctlNewRecord != null) { if (Sql.IsEmptyString(sNAME)) { ctlNewRecord.Clear(); } else { ctlNewRecord.MODULE_NAME = Sql.ToString(ViewState["MODULE_NAME"]); ctlNewRecord.VIEW_NAME = Sql.ToString(ViewState["VIEW_NAME"]); } } // 01/07/2006 Paul. The problem with the ImageButton Delete event was that the dynamically rendered ID // was not being found on every other page request. The solution was to manually name and number the ImageButton IDs. // Make sure not to use ":" in the name, otherwise it will confuse the FindControl function. LayoutView_Bind(dtFields); } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message); ctlLayoutButtons.ErrorText = ex.Message; } }
private void Page_Load(object sender, System.EventArgs e) { try { // 01/08/2006 Paul. The viewstate is no longer disabled, so we can go back to using ctlSearch.NAME. string sNAME = ctlSearch.NAME; //Sql.ToString(Request[ctlSearch.ListUniqueID]); ctlSearch .Visible = Sql.IsEmptyString(sNAME); ctlLayoutButtons.Visible = !ctlSearch.Visible; // 09/08/2007 Paul. Add a list header so we will know what list we are working on. if ( ctlListHeader != null ) { ctlListHeader.Visible = !ctlSearch.Visible; ctlListHeader.Title = sNAME; } if ( !Sql.IsEmptyString(sNAME) && sNAME != Sql.ToString(ViewState["LAYOUT_VIEW_NAME"]) ) { // 01/08/2006 Paul. We are having a problem with the ViewState not loading properly. // This problem only seems to occur when the NewRecord is visible and we try and load a different view. // The solution seems to be to hide the Search dialog so that the user must Cancel out of editing the current view. // This works very well to clear the ViewState because we GET the next page instead of POST to it. SetPageTitle(sNAME); Page.DataBind(); tblMain.EnableViewState = false; string sMODULE_NAME = String.Empty; string sVIEW_NAME = String.Empty; GetModuleName(sNAME, ref sMODULE_NAME, ref sVIEW_NAME); GetLayoutFields(sNAME); LayoutView_Bind(); ViewState["MODULE_NAME" ] = sMODULE_NAME; ViewState["VIEW_NAME" ] = sVIEW_NAME ; ViewState["LAYOUT_VIEW_NAME"] = sNAME ; SaveFieldState(); if ( dtFields.Rows.Count > 0 ) { ViewState["ROW_MINIMUM"] = dtFields.Rows[0][LayoutIndexName()]; } else { ViewState["ROW_MINIMUM"] = 0; } } // 02/08/2007 Paul. The NewRecord control is now in the MasterPage. ContentPlaceHolder plcSidebar = Page.Master.FindControl("cntSidebar") as ContentPlaceHolder; if ( plcSidebar != null ) { ctlNewRecord = plcSidebar.FindControl("ctlNewRecord") as NewRecord; if ( ctlNewRecord != null ) { if ( Sql.IsEmptyString(sNAME) ) { ctlNewRecord.Clear(); } else { ctlNewRecord.MODULE_NAME = Sql.ToString(ViewState["MODULE_NAME"]); ctlNewRecord.VIEW_NAME = Sql.ToString(ViewState["VIEW_NAME" ]); } } } } catch(Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex); ctlLayoutButtons.ErrorText = ex.Message; } }
private void Page_Load(object sender, System.EventArgs e) { try { // 01/08/2006 Paul. The viewstate is no longer disabled, so we can go back to using ctlSearch.NAME. string sNAME = ctlSearch.NAME; //Sql.ToString(Request[ctlSearch.ListUniqueID]); ctlSearch .Visible = Sql.IsEmptyString(sNAME); ctlLayoutButtons.Visible = !ctlSearch.Visible; DataTable dtFields = null; if ( !Sql.IsEmptyString(sNAME) && sNAME != Sql.ToString(ViewState["LAYOUT_VIEW_NAME"]) ) { // 01/08/2006 Paul. We are having a problem with the ViewState not loading properly. // This problem only seems to occur when the NewRecord is visible and we try and load a different view. // The solution seems to be to hide the Search dialog so that the user must Cancel out of editing the current view. // This works very well to clear the ViewState because we GET the next page instead of POST to it. Utils.SetPageTitle(Page, sNAME); Page.DataBind(); tblMain.EnableViewState = false; string sMODULE_NAME = String.Empty; string sVIEW_NAME = String.Empty; GetModuleName(sNAME, ref sMODULE_NAME, ref sVIEW_NAME); dtFields = GetLayoutFields(sNAME).Copy(); ViewState["MODULE_NAME" ] = sMODULE_NAME; ViewState["VIEW_NAME" ] = sVIEW_NAME ; ViewState["LAYOUT_VIEW_NAME"] = sNAME ; ViewState["dtFields" ] = dtFields ; if ( dtFields.Rows.Count > 0 ) { ViewState["ROW_MINIMUM"] = dtFields.Rows[0][LayoutIndexName()]; } else { ViewState["ROW_MINIMUM"] = 0; } } else { dtFields = ViewState["dtFields"] as DataTable; } ctlNewRecord = ctlHeader.FindControl("ctlNewRecord") as NewRecord; if ( ctlNewRecord != null ) { if ( Sql.IsEmptyString(sNAME) ) { ctlNewRecord.Clear(); } else { ctlNewRecord.MODULE_NAME = Sql.ToString(ViewState["MODULE_NAME"]); ctlNewRecord.VIEW_NAME = Sql.ToString(ViewState["VIEW_NAME" ]); } } // 01/07/2006 Paul. The problem with the ImageButton Delete event was that the dynamically rendered ID // was not being found on every other page request. The solution was to manually name and number the ImageButton IDs. // Make sure not to use ":" in the name, otherwise it will confuse the FindControl function. LayoutView_Bind(dtFields); } catch(Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message); ctlLayoutButtons.ErrorText = ex.Message; } }
private void Page_Load(object sender, System.EventArgs e) { try { // 01/08/2006 Paul. The viewstate is no longer disabled, so we can go back to using ctlSearch.NAME. string sNAME = ctlSearch.NAME; //Sql.ToString(Request[ctlSearch.ListUniqueID]); ctlSearch.Visible = Sql.IsEmptyString(sNAME); ctlLayoutButtons.Visible = !ctlSearch.Visible; // 09/08/2007 Paul. Add a list header so we will know what list we are working on. if (ctlListHeader != null) { ctlListHeader.Visible = !ctlSearch.Visible; ctlListHeader.Title = sNAME; } if (!Sql.IsEmptyString(sNAME) && sNAME != Sql.ToString(ViewState["LAYOUT_VIEW_NAME"])) { // 01/08/2006 Paul. We are having a problem with the ViewState not loading properly. // This problem only seems to occur when the NewRecord is visible and we try and load a different view. // The solution seems to be to hide the Search dialog so that the user must Cancel out of editing the current view. // This works very well to clear the ViewState because we GET the next page instead of POST to it. SetPageTitle(sNAME); Page.DataBind(); tblMain.EnableViewState = false; string sMODULE_NAME = String.Empty; string sVIEW_NAME = String.Empty; GetModuleName(sNAME, ref sMODULE_NAME, ref sVIEW_NAME); GetLayoutFields(sNAME); LayoutView_Bind(); ViewState["MODULE_NAME"] = sMODULE_NAME; ViewState["VIEW_NAME"] = sVIEW_NAME; ViewState["LAYOUT_VIEW_NAME"] = sNAME; SaveFieldState(); if (dtFields.Rows.Count > 0) { ViewState["ROW_MINIMUM"] = dtFields.Rows[0][LayoutIndexName()]; } else { ViewState["ROW_MINIMUM"] = 0; } } // 02/08/2007 Paul. The NewRecord control is now in the MasterPage. ContentPlaceHolder plcSidebar = Page.Master.FindControl("cntSidebar") as ContentPlaceHolder; if (plcSidebar != null) { ctlNewRecord = plcSidebar.FindControl("ctlNewRecord") as NewRecord; if (ctlNewRecord != null) { if (Sql.IsEmptyString(sNAME)) { ctlNewRecord.Clear(); } else { ctlNewRecord.MODULE_NAME = Sql.ToString(ViewState["MODULE_NAME"]); ctlNewRecord.VIEW_NAME = Sql.ToString(ViewState["VIEW_NAME"]); } } } } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex); ctlLayoutButtons.ErrorText = ex.Message; } }