using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.UI; using System.Web; using framework_business; public class jQueryHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { // We add control in Page tree collection using (var dummyPage = new Page()) { dummyPage.Controls.Add(GetControl(context)); context.Server.Execute(dummyPage, context.Response.Output, true); } } private ISurfaceBase GetControl(HttpContext context) { // URL path given by load(fn) method on click of button string strPath = context.Request.Url.LocalPath; ISurfaceBase uc = null; using (var dummyPage = new Page()) { if (framework_library.utils.verifySession("SurfaceControlParcel")) { //set up params for the surface control oSurfaceControlParcel parcel = (oSurfaceControlParcel)HttpContext.Current.Session["SurfaceControlParcel"]; uc = dummyPage.LoadControl(parcel.ControlPath) as ISurfaceBase; uc.ID = parcel.ID; uc.SurfaceApp = parcel.SurfaceApp; uc.ParentSurfaceItemId = parcel.ParentSurfaceItemId; uc.ParentSurfaceId = parcel.ParentSurfaceId; uc.SurfaceAppItem = parcel.SurfaceAppItem; uc.SurfaceAppItemId = parcel.SurfaceAppItemId; uc.IsChildSurface = parcel.IsChildSurface; uc.IsSubChildSurface = parcel.IsSubChildSurface; uc.IsClone = parcel.IsClone; //call the reload control method override uc.ReloadControl(parcel.SurfaceAppItem, parcel.IsView, parcel.IsNew); System.Web.UI.WebControls.Panel pnlSurfaceFieldModal = (System.Web.UI.WebControls.Panel)uc.FindControl("pnlSurfaceFieldModal"); if (pnlSurfaceFieldModal != null) pnlSurfaceFieldModal.Visible = false; HttpContext.Current.Session["SurfaceControlParcel"] = null; } } // Loaded user control is returned return uc; } public bool IsReusable { get { return true; } } }