Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

attaching a function to an click_event

Status
Not open for further replies.

duckyboyz

Programmer
Mar 28, 2002
57
US
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
 
Well you are adding a piece of javascript to a button that calls the function "validateRtn". Your only javascript function on the page is named "updateRtn".


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
point taken... sorry, just been looking at this for too long, thanx.

Mike Johnson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top