Aug 03, 2010, 5:24 PM
-
-
-
Aug 03, 2010, 6:09 PMEven after this <ext:ResourcePlaceholder> issue is fixed, I don't think rendering the scripts/styles inside the <body> is the best solution. It might be better to set RenderScripts and RenderStyles to "None" on the ResourceManager, then manually include the require <script> and <style> includes into your custom rendered <head> block.
Example
I'd recommend rendering the scripts/styles into the <head>, and I don't think this will be possible if your <head> section is rendered independently outside of the controls collection.<ext:ResourceManager runat="server" RenderScripts="None" RenderStyles="None" />
-
Aug 03, 2010, 8:23 PMGeoffrey, I actually spent a couple of hours trying to render the scripts into the head. I have the ability to do that but there's no function on ResourceManager to get the scripts. If I set RenderScripts="None", ResourceManager.BuildScripts will not return them. I would like a way for ResourceManager to not add the script includes but still have an exposed function to retrieve them. The reason is that I have custom controls that has Resources property that register their client script files / css files to the ResourceManager. I have tried the following:
But that will only give me the default extjs adapter, extjs all, and extnet core. It wont give me any custom scripts for a particular control or extension that are part of the page.// pseudo code in my Page custom Render function...MyResourceManager initially has RenderScripts = None MyResourceManager.RenderScripts = "Embedded" //MyResourceManager.SetResources() -- this breaks because later on, it will get called again and it errors on dup keys Me.AddToHead(MyResourceManager.BuildScripts()) MyResourceManager.RenderScripts = "None"
-
Aug 04, 2010, 5:39 PMany updates? just want to see what the time estimate is for a fix or a workaround so our qa team can continue testing.
-
Aug 05, 2010, 6:56 PMHi,
Can you update from SVN and retest (ResourcePlaceHolder must be outside the form)?
Also, now you can use the following code to get scripts if RenderScripts="None" (please note that list of scripts is built during render phase only)
ResourceManager1.BuildScripts(true)
-
Aug 05, 2010, 7:30 PMHi,
Just in case, here is the test cases
and<%@ Page Language="C#" %> <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { Response.AddHeader("Pragma", "no-cache"); Response.Cache.SetCacheability(HttpCacheability.NoCache); this.Page.Controls.AddAt(this.Page.Controls.Count-1, new ResourcePlaceHolder()); } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <form id="form1" runat="server"> <ext:ResourceManager ID="ResourceManager1" runat="server"> </ext:ResourceManager> </form> </body> </html>
<%@ Page Language="C#" %> <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { Response.AddHeader("Pragma", "no-cache"); Response.Cache.SetCacheability(HttpCacheability.NoCache); } </script> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server"> </ext:ResourcePlaceHolder> <form id="form1" runat="server"> <ext:ResourceManager ID="ResourceManager1" runat="server"> </ext:ResourceManager> </form> </body> </html>
-
Aug 06, 2010, 1:11 PMBuildScripts(true) doesn't work. It still returns empty string if RenderScripts="None"
The switch statement in BuildScripts doesn't account for type = None.
switch (type) { case ResourceLocationType.Embedded: case ResourceLocationType.CacheFly: foreach (string item in items) { source.Append(string.Format(ResourceManager.ScriptIncludeTemplate, this.GetWebResourceUrl(ResourceManager.ASSEMBLYSLUG + item))); } break; case ResourceLocationType.File: case ResourceLocationType.CacheFlyAndFile: foreach (string item in items) { source.Append(string.Format(ResourceManager.ScriptIncludeTemplate, this.ConvertToFilePath(ResourceManager.ASSEMBLYSLUG + item))); } break; }
-
Aug 06, 2010, 1:25 PMAlso, if I call BuildScripts during the rendering of my custom head, other controls' resources have not been registered yet. Here's what I think is happening:
Page Render
Head Render
Ext.Net.ResourceManager.BuildScripts(true)
Form Render
XControl Render
XControl.RegisterResources <-- this happens AFTER the head has been rendered so this controls' resources are never outputted -
Aug 06, 2010, 1:32 PMHi,
Each control registers own resources during rendering, so, full list of scripts is available after last control rendering
Therefore BuildScripts method is not so useful for you.
What about to place ResourcePlaceHolder at the end of the body (like in my test case)?
this.Page.Controls.AddAt(this.Page.Controls.Count-1, new ResourcePlaceHolder());
Similar Threads
-
Combobox Item with operation symbols
By inaltec in forum 1.x HelpReplies: 1Last Post: Feb 01, 2012, 5:39 PM -
about objectdatasource CRUD operation issue?
By neo in forum 1.x HelpReplies: 0Last Post: Nov 30, 2011, 12:51 PM -
Grid Panel Export Operation
By sumesh in forum 1.x HelpReplies: 1Last Post: May 30, 2011, 11:32 AM -
Operation Requires an Ajax Request
By dan182 in forum 1.x HelpReplies: 1Last Post: Feb 23, 2011, 12:58 PM -
This operation requires an Ajax request
By dan182 in forum 1.x HelpReplies: 0Last Post: Feb 03, 2011, 10:34 AM