开发者

ASP.NET button and Jquery works together?

开发者 https://www.devze.com 2022-12-12 20:43 出处:网络
I have an ASP button, when I click this button, first I want to run code behind progress such as data delete, update..

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消