Reputation: 81342
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
Reputation: 27352
ClientScriptManager.RegisterStartupScript(this.GetType(), "keyForScript", "alert('error!')", true);
http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx
Upvotes: 2