Forum  General Visual ...  How do I...?  script block cannot include in XLST file
Previous Previous
 
Next Next
New Post 7/1/2012 10:32 PM
  guaike
91 posts
jintan.cnblogs.com
No Ranking


script block cannot include in XLST file 
Modified By guaike  on 7/7/2012 2:40:26 AM)

Hi,

I need call script when my custom control render the XLST, something like this

 <?xml version="1.0" encoding="UTF-8" ?>

 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:WC="wgcontrols">
	<xsl:template match="WC:GZIP" mode="modContent">
		<xsl:attribute name="Class">ImageProcessor-Control</xsl:attribute>
    <script >       aler t(1)     </script > 
	</xsl:template>
</xsl:stylesheet>  But the script never execute .

 
New Post 7/19/2012 2:50 PM
  palli
14295 posts
1st Level Poster




Re: script block cannot include in XLST file 

 Hi,

Take a look at our custom controls article here, which I believe has the information you are looking for and much more.

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 7/20/2012 8:38 PM
  guaike
91 posts
jintan.cnblogs.com
No Ranking


Re: script block cannot include in XLST file 
Modified By guaike  on 7/21/2012 12:23:19 AM)

Hi Palli, 

I tried to do this follow your give me article link , if i added something like this code in My custome control's XLST file ,

<img style="visibility:hidden;height:0;width:0" 
 src="Resources.Gizmox.WebGUI.Forms.Skins.CommonSkin.Empty.gif.wgx" 
 onload="do something..." >
</img>  

  it working fine in IE and FireFox, but it did not work in Chrome, Chrome will show me a blank page ,All of the controls are not displayed.

BTW: I am using VWG 6.4.0d , Test in Google Chrom 18.0.1025.151 , Google Chrom 20.0.1132.57

And I have sent the demo code to support Email.

 

Jim

 
New Post 7/23/2012 3:42 PM
  palli
14295 posts
1st Level Poster




Re: script block cannot include in XLST file 

 Hi Jim,

Argggggg.... browsers, browsers, browsers :-)

One more thing to be aware of in browser difference list. My tests show that for whatever reason, Chrome simply doesn't like to have this dummy img tag as early in the markup as you placed it. Simply by moving the dummy img tag down below the call to tplDrawLabelAPI, Chrome works fine too.

Your next logical question will probably be how I did find out. Well, based on my experience with web browsers and their differences, that is something you always need to keep in your mind when customizing the client side of controls. The method I used was to inspect the rendered Html in Chrome (using F12 in Chrome) and noticed that there was an empty div where the form's contents should have been. I then built another form using standard label control and it was working fine. At that point I started removing parts of your dummy img tag in you xslt and when that didn't work either, I started moving it around. So, it's not that I knew up front what was the problem, rather that I suspected something like this would be the cause and made a few tests. 

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  How do I...?  script block cannot include in XLST file
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS