In my VB code I get an error message when I call a VB procedure from OnclientClick event of asp button.
-> I tried an alternate option of using a JavaScript function but IE and FireFox behaved differently to that:
a) IE : successful execution
b) FireFox: No Reponse
Q1: Could you help me with why I get the error "<procedure-name> is undefined" on calling VB procedure at OnClientCLick event for the ASP button.
Q2: And why does FireFox not respond to the JavaScript Function call.
Please Find the Code Snippet below___________________
A) VB & JavaScript Code
<html xmlns="
http://www.w3.org/1999/xhtml"
>
<head id="Head1" runat="server">
<script LANGUAGE="JavaScript" type="text/javascript">
function testResults(form) {
var strTitle = document.getElementById('T
extBox0').
value
var strSponsor = document.getElementById('T
extBox3').
value
//document.getElementById(
'TextBox1'
).value = strTitle
//document.getElementById(
'TextBox2'
).value = strSponsor
//Response.Redirect("Study
InterfaceA
dvancedSea
rch.asp.as
px")
window.location.replace("
http://160.94.85.5:3514/Website2/Test-StudyInterfaceAdvancedSearch-List.asp.aspx?strTitle="
+ strTitle + "&strSponsor=" +strSponsor);
}
</script>
<script language="VB" runat="server">
Sub redirect(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strTitle As String = TextBox0.Text
Dim strSponsor As String = TextBox3.Text
Response.Redirect("
http://160.94.85.5:3514/Website2/Test-StudyInterfaceAdvancedSearch-List.asp.aspx?strTitle=" + strTitle + "&strSponsor=" + strSponsor)
End Sub
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
</script>
<title>Database Connection</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
B) ASP button parameters used for calling Javascript function and VB procedure are below
-For Javascript function: testResults
<asp:Button ID="Button1" runat="server" Text="Search" Width="200px" OnClientClick="javascript:
testResult
s();" />
-For VB procedure redirect
<asp:Button ID="Button1" runat="server" Text="Search" Width="200px" OnClientClick="redirect" />
Start Free Trial