sarsnake
sarsnake

Reputation: 27713

Executing JavaScript from the server code in asp.net

Here is what I need to do: I need to execute some server side code after a user clicks on a button, THEN I need to execute some client side code. OnClientClick gets invoked BEFORE the onClick; and what I need is the opposite.

Is there a way to do this? It looks like I will have to execute JS code from the server code.

Upvotes: 0

Views: 276

Answers (1)

ChrisLively
ChrisLively

Reputation: 88064

You could use RegisterStartupScript in the code behind of your app.

This would place the javascript code you need to be called in the body.onload event.

Upvotes: 1

Related Questions