JL.
JL.

Reputation: 81342

ASP.net , how display an alert box from server side code?

I have a asp:button onclick... What I would like to do is display a JS alert should a condition not be met. I'm wondering how can I call or create the simple JS function from server side code?

Upvotes: 0

Views: 3607

Answers (1)

Jan Jongboom
Jan Jongboom

Reputation: 27352

ClientScriptManager.RegisterStartupScript(this.GetType(), "keyForScript", "alert('error!')", true);

http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx

Upvotes: 2

Related Questions