Click here to Skip to main content
11,409,801 members (48,981 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript
Hi,

I am using vs2010 in windows7 32bit.

And i have below code and it does not work at all.

What should i do?

---------------------------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
 
<!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 runat="server">
<title></title>
 
<script type="text/vbscript">
Sub SelectItem2()
MsgBox "test vbscript.", vbInformation, "OK"
End Sub
</script>
 
<script type="text/javascript">
function SelectItem() {
alert("test javascript");
}
</script>
</head>
<body>
<form id="form1" runat="server">
 

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="vbscript:SelectItem2()" />
<asp:Button ID="Button2" runat="server" Text="Button22" OnClientClick="SelectItem();" />
 

</form>
</body>
</html>
Posted 12-Feb-13 22:40pm
Edited 13-Feb-13 2:53am
Maciej Los177.4K
v2
Comments
Richard MacCutchan at 13-Feb-13 4:49am
   
Explain what it should do and what happens when you run it.
ryanb31 at 13-Feb-13 7:55am
   
What doesn't work?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,

This is working fine for me:
The script-tags:
<script type="text/vbscript" runat="server">
Sub SelectItem2()
MsgBox ("test vbscript.", vbInformation, "OK")
End Sub
</script>
 
<script type="text/javascript">
    function SelectItem() {
        alert("test javascript");
    }
</script>
The asp:Button-tags:
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="SelectItem2" />
<asp:Button ID="Button2" runat="server" Text="Button22" OnClientClick="SelectItem();" />
Hope this helps.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 270
1 OriginalGriff 255
2 Maciej Los 138
3 Andy Lanng 105
4 Sascha Lefévre 95
0 Sergey Alexandrovich Kryukov 8,771
1 OriginalGriff 6,905
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100