![]() |
javaScript
Hi...
I have an aspx page and a c# codebehind. How can I call a javaScript function before the codebehind is executed. I used the 'standard' controls (visual studio 2005 professional) so that when i double click on the control ie: a button the event code is generated in the c# codebehind... I have a javaScript function called validateMe() and in the standard control's tag in the aspx file i add onclick="validateMe()" and i receive an error saying there is no such function 1. What is the difference between the 'standard' controlls in visual studio and the html controlls in visual studio ? 2. I have a standard button on my form. I tried adding onsubmit="validateMe()" and it did not get triggered -- but i got an error that such function doesnt exist Thnx :
<asp:Button ID="submit" onclick="validateMe()" runat="server" BackColor="Highlight" BorderColor="White":
function validateMe() |
Paul, do you understand the nature of the client/server paradigm?
|
Ah DaWei,
I do understand the seperation of client server, my problem is i am new to ASP.net and my way of thinking is more that of ASP. How can I cause my client side validation script to execute before the server-side cs program is executed. In classic ASP i wold put 'onsubmit="validateMe()" to the form tag. But it seems that the button I added isnt a 'submit' button... its a 'standard' control (in visual studio) |
Howzabout 'onclick = "validateMe ()";' and the last statement, if valid, is a submit?
|
I think this is what you are looking for.
http://www.c-sharpcorner.com/UploadF...b-df0c669afd6c which would be like using this (OnClientClick) :
If true is returned then it will submit I believe and if false then it won't. |
Perfect, thanks
|
| All times are GMT -5. The time now is 2:56 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC