/// <summary> /// returns rendered control's string representation. /// object "data" should be passed from javascript method /// as array of objects consisting of two objects, /// first - pageID - integer identificator by which we will /// lookup real control path; second object may be some data /// that the control needs. /// </summary> public object GetWizardPage(object data) { bool errorLogged = false; try { Dictionary <string, object> param = (Dictionary <string, object>)data; int pageID = (int)param["pageID"]; object customData = param["data"]; string controlPath = m_NavigationData.Find(x => x.Key == pageID).Value; if (!String.IsNullOrEmpty(controlPath)) { if ( controlPath.ToLower() .EndsWith(".htm") || controlPath.ToLower() .EndsWith(".html") || controlPath.ToLower() .EndsWith(".txt")) { string result = ""; using ( TextReader tr = new StreamReader( HttpContext.Current.Server.MapPath(controlPath) ) ) { result = tr.ReadToEnd(); } return(new ContentsResponse(result, string.Empty, string.Empty)); } else { return(TemplateViewManager.RenderView(controlPath, customData)); } } } catch (Exception ex) { ex.ToString(); // Log error errorLogged = true; } if (!errorLogged) { // Log custom error saying // we did not find the page } return(ContentsResponse.Empty); }
/// <summary> /// returns rendered control's string representation. /// object "data" should be passed from javascript method /// as array of objects consisting of two objects, /// first - pageID - integer identificator by which we will /// lookup real control path; second object may be some data /// that the control needs. /// </summary> public object GetWizardPage(string controlPath) { bool errorLogged = false; try { if (!String.IsNullOrEmpty(controlPath)) { if ( controlPath.ToLower() .EndsWith(".htm") || controlPath.ToLower() .EndsWith(".html") || controlPath.ToLower() .EndsWith(".txt")) { string result = ""; using ( TextReader tr = new StreamReader( HttpContext.Current.Server.MapPath(controlPath) ) ) { result = tr.ReadToEnd(); } return(new ContentsResponse(result, string.Empty, string.Empty)); } else { return(TemplateViewManager.RenderView(controlPath)); } } } catch (Exception ex) { ex.ToString(); // Log error errorLogged = true; } if (!errorLogged) { // Log custom error saying // we did not find the page } return(ContentsResponse.Empty); }