public static UpdatePanelRequestType Requested(this UpdatePanelScope panel) { return(panel.Data().AddOrGetExisting("UpdatePanelRequestType", () => { var actionContext = panel.ActionContext(); var currentId = panel.Id(); var requestedId = actionContext.UpdatePanelRequestedId(); if (string.IsNullOrEmpty(requestedId)) { return UpdatePanelRequestType.EntireView; } if (requestedId == currentId) { return UpdatePanelRequestType.CurrentPanel; } if (requestedId.StartsWith(currentId)) { return UpdatePanelRequestType.ChildPanel; } if (currentId.StartsWith(requestedId)) { return UpdatePanelRequestType.Parent; } return UpdatePanelRequestType.OtherPanel; })); }
/// <summary> /// Retrieve call back URL /// </summary> /// <param name="panel"></param> /// <returns></returns> public static string GetCallbackUrl(this UpdatePanelScope panel) { var ctx = panel.Page.ActionContextsStack().Last(); var originalUrl = new Uri(ctx.HttpContext.Request.RawUrl, UriKind.Relative); var url = originalUrl.ExtendQuery(new Dictionary <string, string> { { UpdatePanelUrlParameterName, panel.Id() } }); return(url.ToString()); }
public static System.Web.WebPages.HelperResult BeginUpdatePanel(UpdatePanelScope updatePanel) { #line default #line hidden return new System.Web.WebPages.HelperResult(__razor_helper_writer => { #line 7 "..\..\UpdatePanelTemplate.cshtml" var elementId = updatePanel.Data().AddOrGetExisting("ElementId", ()=>Guid.NewGuid().ToString("N")); var id = updatePanel.Id(); #line default #line hidden WriteLiteralTo(__razor_helper_writer, " <div class=\"updatePanel\" id=\""); #line 10 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, elementId); #line default #line hidden WriteLiteralTo(__razor_helper_writer, "\" data-updatePanel=\""); #line 10 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, id); #line default #line hidden WriteLiteralTo(__razor_helper_writer, "\">\r\n"); WriteLiteralTo(__razor_helper_writer, " <div"); WriteLiteralTo(__razor_helper_writer, " class=\"updatePanel-loading\""); WriteLiteralTo(__razor_helper_writer, " data-updatePanel=\""); #line 11 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, id); #line default #line hidden WriteLiteralTo(__razor_helper_writer, "\""); WriteLiteralTo(__razor_helper_writer, ">\r\n"); #line 12 "..\..\UpdatePanelTemplate.cshtml" #line default #line hidden #line 12 "..\..\UpdatePanelTemplate.cshtml" if (updatePanel.Settings.RenderLoadingDiv != null) { #line default #line hidden #line 14 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, updatePanel.Settings.RenderLoadingDiv(updatePanel)); #line default #line hidden #line 14 "..\..\UpdatePanelTemplate.cshtml" ; } else { #line default #line hidden WriteLiteralTo(__razor_helper_writer, " "); WriteLiteralTo(__razor_helper_writer, "Loading...please wait\r\n"); #line 19 "..\..\UpdatePanelTemplate.cshtml" } #line default #line hidden WriteLiteralTo(__razor_helper_writer, " </div>\r\n"); WriteLiteralTo(__razor_helper_writer, " "); WriteLiteralTo(__razor_helper_writer, "<div class=\"updatePanel-content\" data-updatePanel=\""); #line 21 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, id); #line default #line hidden WriteLiteralTo(__razor_helper_writer, "\">\r\n"); #line 22 "..\..\UpdatePanelTemplate.cshtml" #line default #line hidden }); #line 22 "..\..\UpdatePanelTemplate.cshtml" }
public static System.Web.WebPages.HelperResult EndUpdatePanel(UpdatePanelScope updatePanel) { #line default #line hidden return new System.Web.WebPages.HelperResult(__razor_helper_writer => { #line 24 "..\..\UpdatePanelTemplate.cshtml" var elementId = updatePanel.Data()["ElementId"] as string; var id = updatePanel.Id(); #line default #line hidden WriteLiteralTo(__razor_helper_writer, " </div>\r\n"); WriteLiteralTo(__razor_helper_writer, " <script>\r\n (function()\r\n {\r\n " + " //DisableLinePragmas: true\r\n var id = "); #line 34 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, J(id)); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ";\r\n var elementId = "); #line 35 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, J(elementId)); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ";\r\n var callbackUrl = "); #line 36 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, J(updatePanel.GetCallbackUrl())); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ";\r\n var settings = "); #line 37 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, J(updatePanel.Settings)); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ";\r\n settings.elementId = elementId;\r\n var p" + "anel = UpdatePanels.CreateUpdatePanel(id, callbackUrl, settings);\r\n"); #line 40 "..\..\UpdatePanelTemplate.cshtml" #line default #line hidden #line 40 "..\..\UpdatePanelTemplate.cshtml" if (!string.IsNullOrEmpty(updatePanel.Settings.JSInit)) { #line default #line hidden WriteLiteralTo(__razor_helper_writer, " "); WriteLiteralTo(__razor_helper_writer, "("); #line 42 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, updatePanel.Settings.JSInit); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ")(panel);\r\n"); #line 43 "..\..\UpdatePanelTemplate.cshtml" } #line default #line hidden WriteLiteralTo(__razor_helper_writer, " })();\r\n </script>\r\n"); WriteLiteralTo(__razor_helper_writer, " </div>\r\n"); #line 47 "..\..\UpdatePanelTemplate.cshtml" #line default #line hidden }); #line 47 "..\..\UpdatePanelTemplate.cshtml" }
public static System.Web.WebPages.HelperResult BeginUpdatePanel(UpdatePanelScope updatePanel) { #line default #line hidden return(new System.Web.WebPages.HelperResult(__razor_helper_writer => { #line 7 "..\..\UpdatePanelTemplate.cshtml" var elementId = updatePanel.Data().AddOrGetExisting("ElementId", () => Guid.NewGuid().ToString("N")); var id = updatePanel.Id(); #line default #line hidden WriteLiteralTo(__razor_helper_writer, " <div class=\"updatePanel\" id=\""); #line 10 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, elementId); #line default #line hidden WriteLiteralTo(__razor_helper_writer, "\" data-updatePanel=\""); #line 10 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, id); #line default #line hidden WriteLiteralTo(__razor_helper_writer, "\">\r\n"); WriteLiteralTo(__razor_helper_writer, " <div"); WriteLiteralTo(__razor_helper_writer, " class=\"updatePanel-loading\""); WriteLiteralTo(__razor_helper_writer, " data-updatePanel=\""); #line 11 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, id); #line default #line hidden WriteLiteralTo(__razor_helper_writer, "\""); WriteLiteralTo(__razor_helper_writer, ">\r\n"); #line 12 "..\..\UpdatePanelTemplate.cshtml" #line default #line hidden #line 12 "..\..\UpdatePanelTemplate.cshtml" if (updatePanel.Settings.RenderLoadingDiv != null) { #line default #line hidden #line 14 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, updatePanel.Settings.RenderLoadingDiv(updatePanel)); #line default #line hidden #line 14 "..\..\UpdatePanelTemplate.cshtml" ; } else { #line default #line hidden WriteLiteralTo(__razor_helper_writer, " "); WriteLiteralTo(__razor_helper_writer, "Loading...please wait\r\n"); #line 19 "..\..\UpdatePanelTemplate.cshtml" } #line default #line hidden WriteLiteralTo(__razor_helper_writer, " </div>\r\n"); WriteLiteralTo(__razor_helper_writer, " "); WriteLiteralTo(__razor_helper_writer, "<div class=\"updatePanel-content\" data-updatePanel=\""); #line 21 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, id); #line default #line hidden WriteLiteralTo(__razor_helper_writer, "\">\r\n"); #line 22 "..\..\UpdatePanelTemplate.cshtml" #line default #line hidden })); #line 22 "..\..\UpdatePanelTemplate.cshtml" }
public static System.Web.WebPages.HelperResult EndUpdatePanel(UpdatePanelScope updatePanel) { #line default #line hidden return(new System.Web.WebPages.HelperResult(__razor_helper_writer => { #line 24 "..\..\UpdatePanelTemplate.cshtml" var elementId = updatePanel.Data()["ElementId"] as string; var id = updatePanel.Id(); #line default #line hidden WriteLiteralTo(__razor_helper_writer, " </div>\r\n"); WriteLiteralTo(__razor_helper_writer, " <script>\r\n (function()\r\n {\r\n " + " //DisableLinePragmas: true\r\n var id = "); #line 34 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, J(id)); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ";\r\n var elementId = "); #line 35 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, J(elementId)); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ";\r\n var callbackUrl = "); #line 36 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, J(updatePanel.GetCallbackUrl())); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ";\r\n var settings = "); #line 37 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, J(updatePanel.Settings)); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ";\r\n settings.elementId = elementId;\r\n var p" + "anel = UpdatePanels.CreateUpdatePanel(id, callbackUrl, settings);\r\n"); #line 40 "..\..\UpdatePanelTemplate.cshtml" #line default #line hidden #line 40 "..\..\UpdatePanelTemplate.cshtml" if (!string.IsNullOrEmpty(updatePanel.Settings.JSInit)) { #line default #line hidden WriteLiteralTo(__razor_helper_writer, " "); WriteLiteralTo(__razor_helper_writer, "("); #line 42 "..\..\UpdatePanelTemplate.cshtml" WriteTo(__razor_helper_writer, updatePanel.Settings.JSInit); #line default #line hidden WriteLiteralTo(__razor_helper_writer, ")(panel);\r\n"); #line 43 "..\..\UpdatePanelTemplate.cshtml" } #line default #line hidden WriteLiteralTo(__razor_helper_writer, " })();\r\n </script>\r\n"); WriteLiteralTo(__razor_helper_writer, " </div>\r\n"); #line 47 "..\..\UpdatePanelTemplate.cshtml" #line default #line hidden })); #line 47 "..\..\UpdatePanelTemplate.cshtml" }