net usercontrol located on on my aspx page. In the usercontrol there is a javascript function that I would like to fire everytime the page that contains the usercontrol submits to the server. (directly before this happens) Ideally I prefer to not have to write any code in the parent to make this happen, but I am not sure what the usercontrol may be capable of at this time. Can the usercontrol know that the page is submitting to the server and fire the function before this happens? Is there some sort of event that takes place here?
Is this possible? And is my description clear?
Thanks!
you can add a client side event handler for the form’s
submitevent. you can generate your javascript whenPage_Loadis called in the user control and usePage.ClientScript.RegisterStartupScriptto add it to the page.the script will only be added once for each combination of the
typeandkeyparameters, so you can have multiple user controls on the page and this script will only be added once.