VBSCRIPT with autopostback - VS2005

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a problem with client-side VBSCRIPT on a page with auto-postback
controls.
I have generated a simple page with a listbox, set to autopostback. This
works OK. If I then generate some client-side VBSCRIPT, VS creates a VBSCRIPT
script block. Even if I delete everything within the block, just leaving the
<script> </script> tags, I get an error on the page if I click an item in the
list box. If I use JScript, rather than VBScript, I don;t see the issue. This
was all working with VS2003, but not with 2005. The only difference I can
see, is that, for the postback, VS2005 generates

javascript:settimeout(__DoPostback(...),0)

whereas VS2003 does not generate the settimeout:-

javascript:__DoPostback(...)

Anyone come across this problem? I'm converting quite a large VS2003 app to
VS2005, and don't really want to have to rewrite all my client-side scripts
in JScript.
 
Do your client side <script> tags specify the type? e.g.

<script type="text/vbscript">

</script>
 
JohnHorb said:
Yes. as I say, the annoying thing is it all worked fine in VS2003.

Well after some hours of hard googling, found that the answer is to move the
vbscript block from the top of the file, where VS2005 puts it, to after the
</body> tag. (I suspect the crtical thing is to ensure it goes after the
jscript __DoPostback block).
 
Back
Top