I have a server side method that given a string of JScript as an input returns a compressed "minified" version.
I want to run some code after the page has loaded to find all RadCodeBlocks and RadScriptBlocks and minify their content before the page is finally rendered in the browser.
I can do this for some RadScriptBlocks but not all of them.
Some of them simply appear to have no sub controls at all and so I can't get what they currently contain in order to minify them.
I call something similar to the following in every page's Page_PreRender,
Like I say, it successfully finds all the RadScriptBlocks and RadCodeBlocks on every page but some of them have Controls.Count = 0 and so I can't get at their content to correct it. Have tried calling my MinifyAllPageJScript from various event methods but with no luck.
Little help?
Regards
ADe
I want to run some code after the page has loaded to find all RadCodeBlocks and RadScriptBlocks and minify their content before the page is finally rendered in the browser.
I can do this for some RadScriptBlocks but not all of them.
Some of them simply appear to have no sub controls at all and so I can't get what they currently contain in order to minify them.
I call something similar to the following in every page's Page_PreRender,
public static void MinifyAllPageJScript(ControlCollection PageControls) |
{ |
foreach (Control pageControl in PageControls) |
{ |
if ((pageControl as RadScriptBlock) != null || |
(pageControl as RadCodeBlock) != null) |
{ |
foreach (Control script in pageControl.Controls) |
{ |
if ((script as LiteralControl) != null) |
{ |
(script as LiteralControl).Text = Common.CompressJS((script as LiteralControl).Text); |
} |
} |
} |
MinifyAllPageJScript(pageControl.Controls); |
} |
} |
Like I say, it successfully finds all the RadScriptBlocks and RadCodeBlocks on every page but some of them have Controls.Count = 0 and so I can't get at their content to correct it. Have tried calling my MinifyAllPageJScript from various event methods but with no luck.
Little help?
Regards
ADe