This question is locked. New answers and comments are not allowed.
Ok, so for my project I needed to load data into an iframe (I chose this method, rather than submitting asynchronously, purposely, thanks) every time that the modal was launched, not just when the modal was created. Unfortunately the 'LoadContentFrom' method only load things once. So how did I get around it? By making a few changes...
Step 1: In Window\Fluent\WindowBuilder.cs:
Step 2: In Window\Window.cs:
Step 3: In the Windows\WindowHtmlBuilder.cs
Step 4: In the Scripts\telerik.window.js
Basically AsyncModes.None is default and should load the Content() method as standard. The AsyncModes.Normal will do the LoadContentFrom as standard. The AynscModes.IFrame will load the LoadContentFrom url each time the modal is opened; you can use the setContentUrl javascript method to adjust the content url between modal opens.
Step 1: In Window\Fluent\WindowBuilder.cs:
/// <summary> /// Sets the asynchronous callback mode of the window. /// </summary> public WindowBuilder AsyncMode(Window.AsyncModes type) { Component.AsyncMode = type; return this; }Step 2: In Window\Window.cs:
public AsyncModes AsyncMode { get { return _asyncMode; } set { _asyncMode = value; } } public string ContentUrl { get { return loadContentFromUrl; } set { ... if (!string.IsNullOrEmpty(loadContentFromUrl)) { if (AsyncMode == AsyncModes.None) AsyncMode = AsyncModes.Normal; } } } public override void WriteInitializationScript(TextWriter writer) { ... //properties ... objectWriter.Append("asyncMode", AsyncMode.ToString()); ... } private AsyncModes _asyncMode = AsyncModes.None; public enum AsyncModes { None, IFrame, Normal }Step 3: In the Windows\WindowHtmlBuilder.cs
public IHtmlNode ContentTag() { ... // Replace this... //if (Window.ContentUrl.HasValue() // && (Window.ContentUrl.StartsWith("http", System.StringComparison.InvariantCultureIgnoreCase) // || Window.ContentUrl.StartsWith("https", System.StringComparison.InvariantCultureIgnoreCase))) // With this... if (Window.ContentUrl.HasValue() && (Window.ContentUrl.StartsWith("http", System.StringComparison.InvariantCultureIgnoreCase) || Window.ContentUrl.StartsWith("https", System.StringComparison.InvariantCultureIgnoreCase) || Window.AsyncMode == UI.Window.AsyncModes.IFrame)) { // Replace this... //new HtmlTag("iframe") // .Attributes(new { // src = Window.ContentUrl, // title = Window.Title, // style = "border: 0; width: 100%; height: 100%;", // frameborder = "0" // }) // .AppendTo(content); // With this... new HtmlTag("iframe") .Attributes(new { src = (Window.AsyncMode == UI.Window.AsyncModes.IFrame ? "about:blank" : Window.ContentUrl), title = Window.Title, style = "border: 0; width: 100%; height: 100%;", frameborder = "0" }) .AppendTo(content); } ... }Step 4: In the Scripts\telerik.window.js
// In the $t.window = function (element, options) { comment out the following: if (isLocalUrl(this.contentUrl)) this.ajaxRequest();
setContentUrl:
function (url) {
this.contentUrl = url;
return this;
},
// Adjust the open method... open: function (e) { ... if (!$t.trigger(this.element, 'open')) { // Replace the following... //if (this.contentUrl) //this.ajaxRequest(); // With this... if (isLocalUrl(this.contentUrl)) this.ajaxRequest(); .... } .... }, ajaxRequest: function (url) { ... var data = {}; // Clear the contents prior to calling request; if the request requires // time to process it should not display stale content. $('.t-window-content', this.element).html('<div></div>'); .... },Basically AsyncModes.None is default and should load the Content() method as standard. The AsyncModes.Normal will do the LoadContentFrom as standard. The AynscModes.IFrame will load the LoadContentFrom url each time the modal is opened; you can use the setContentUrl javascript method to adjust the content url between modal opens.