There is a button in the form to add and use. In the protected void add_button_click (Object sender, eventargs E) of this button, data is added to the database. However, at the same time, I want to click this button to perform JS Form validation on the form. I don't know how to implement it. I tried to add an onclick time for the button in page_load to trigger a JS script, in this case, you cannot click the button to add it. What should I do?
<Asp: linkbutton id = "linkbutton1" runat = "server" onclick = "button1_click" onclientclick = "javascript: Return user_see ()"> View </ASP: linkbutton>
Write Data to the server in the button#click eventCode
User_see is the clientProgramReturns true to execute button#click, and returns false to automatically stop executing.
Function user_see ()
{
If (confirm ('Do you really want to execute the server code? '))
{
Return true;
}
Else
{
Return false;
}
}
This can be used in the 2.0 Framework
Btn_del.attributes.add ("onclick", "javascript: Return del ();")