ASP.NET button and Jquery works together?
I have an ASP button
, when I click this button, first I want to run code behind progress such as data delete, update..
After 开发者_Go百科this progress, I want to runJquery
function related this button.
How can I do that?
Your server-side event handler can call ScriptManager.RegisterStartupScript to invoke jQuery in the browser.
If I interpret your question correctly, you want to post back to the server so you can run your code, and when you return, you want to run some jquery. Is that correct?
If so, you'll need to inject some jquery into the response after you do your work.
So your code-behind will delete a record or run an update, then write some jquery to the response which will run when the page is built on the client. You might want to use the Page.RegisterStartupScript
method to do this.
An alternative is to go down the ajax route, but that's a bit more complicated.
精彩评论