Click here to Skip to main content
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 Los150.8K
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 OriginalGriff 195
1 ProgramFOX 130
2 Maciej Los 105
3 Sergey Alexandrovich Kryukov 105
4 Afzaal Ahmad Zeeshan 82
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2014
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