VBScript causing problems

R

rishabhshrivastava

Hello All,
I am using ASP.NET 2.0 and I am experiencing a problem using vbscript
that is this script on client side is preventing the postback of my
controls.

I have a dropdownlist which is supposed to perform some fucntion when
the selected index is changed, it works fine without vbscript code(when
i comment out that code) but when I uncomment the code the postback
dosen't happen.

Any ideas/suggestions will really be appreciated.


Thanks.
 
J

Juan T. Llibre

You don't use vbscript as a client language in ASP.NET.
Use Javascript instead, if you must use client script.
 
R

rishabhshrivastava

Juan,
But in ASP.NET 1.1 I have used vbscript as a client side scripting
language....has it changed in 2.0???
 
J

Juan T. Llibre

re:
But in ASP.NET 1.1 I have used vbscript as a client side scripting
language....has it changed in 2.0???

Please post a working sample of Vbscript working under ASP.NET 1.1.




Juan,
But in ASP.NET 1.1 I have used vbscript as a client side scripting
language....has it changed in 2.0???
 
R

rishabhshrivastava

What does this means then???
<meta content="VBScript" name="vs_defaultClientScript">
And I have used vbscript at client side to perform certain functions
like :-

AT SERVER SIDE:-
button1.Attributes.Add("onclick", "return test()")

AT CLIENT SIDE :-
<script language="vbscript">
function test
document.getelementbyid("textbox1").value =
parent.main.document.documentelement.outerhtml
end function
</script>

This is a Working Example in 1.1 using vbscript and this code will put
OuterHtml in textbox1 when you click button1.

Thanks.
 
J

Juan T. Llibre

re:
AT SERVER SIDE:-
button1.Attributes.Add("onclick", "return test()")

Sorry, that's Javascript..

re:
---00---
AT CLIENT SIDE :-
<script language="vbscript">
function test
document.getelementbyid("textbox1").value =
parent.main.document.documentelement.outerhtml
end function
</script>
---00---

I've never seen VBScript working that way.

You might be able to get it to work this way :

Page.RegisterStartupScript( MyDataGrid.UniqueID,
"<script language='vbscript'>ProcessDataGrid( '" & MyDataGrid.ClientID & "' )</script>

In truth, VBscript was orphaned in ASP.NET.

See :
http://www.devx.com/DevX/Article/15821?type=kbArticle&trk=MSCP

Quite frankly, VBScript sucks...except as vbs scripts to be run with WScript and/or Cscript.
As a client scripting language, it's only understood by IE and the market is a lot more than just
IE.

I encourage you to stop butting your head against the wall...and use Javascript.




What does this means then???
<meta content="VBScript" name="vs_defaultClientScript">
And I have used vbscript at client side to perform certain functions
like :-

AT SERVER SIDE:-
button1.Attributes.Add("onclick", "return test()")

AT CLIENT SIDE :-
<script language="vbscript">
function test
document.getelementbyid("textbox1").value =
parent.main.document.documentelement.outerhtml
end function
</script>

This is a Working Example in 1.1 using vbscript and this code will put
OuterHtml in textbox1 when you click button1.

Thanks.
 
L

Laurent Bugnion

Hi Juan,
You don't use vbscript as a client language in ASP.NET.
Use Javascript instead, if you must use client script.

Since the script language used is a matter of the client, and since IE
understands VBScript as well as JavaScript, I don't see why VBScript
wouldn't work. However, the client-side language of choice is and
remains JavaScript. Firefox and other major web clients don't understand
VBScript anyway. My guess is that it's going to slowly disappear, but it
will still be supported in IE to avoid breaking existing web pages.

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top