i want both the vb.net click_event and the javascript function to fire. right now only the click_event fires when i hit the update button. got a task where i have to javascript for the form validation. can anyone see why this is'nt working:
<%@ Page Language="VB" %>
<script runat="server">
' Insert page code here
'
Sub Page_load(obj as object, e as eventArgs)
If (Not Page.IsPostBack) Then
btnUpdate.Attributes.Add("onClick", "javascript:return validateRtn();")
end if
end sub
Sub btnUpdate_Click(sender As Object, e As EventArgs)
textbox1.text = "hi"
End Sub
</script>
<html>
<head>
<script language="javascript">
function updateRtn()
{
alert("hello world")
}
</script>
</head>
<body>
<form id="form1" runat="server">
<p>
</p>
<p>
</p>
<p>
<asp:Label id="Label1" runat="server">last name </asp:Label>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
</p>
<p>
</p>
<p>
<asp:Button id="btnUpdate" onclick="btnUpdate_Click" runat="server" Text="update"></asp:Button>
</p>
</form>
</body>
</html>
Mike Johnson
<%@ Page Language="VB" %>
<script runat="server">
' Insert page code here
'
Sub Page_load(obj as object, e as eventArgs)
If (Not Page.IsPostBack) Then
btnUpdate.Attributes.Add("onClick", "javascript:return validateRtn();")
end if
end sub
Sub btnUpdate_Click(sender As Object, e As EventArgs)
textbox1.text = "hi"
End Sub
</script>
<html>
<head>
<script language="javascript">
function updateRtn()
{
alert("hello world")
}
</script>
</head>
<body>
<form id="form1" runat="server">
<p>
</p>
<p>
</p>
<p>
<asp:Label id="Label1" runat="server">last name </asp:Label>
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
</p>
<p>
</p>
<p>
<asp:Button id="btnUpdate" onclick="btnUpdate_Click" runat="server" Text="update"></asp:Button>
</p>
</form>
</body>
</html>
Mike Johnson