0

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?

1 Answer 1

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

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

Sign up to request clarification or add additional context in comments.

1 Comment

Well he just puts this somewhere in his codebehind when a condition is met, so I thinks it answers his question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.