Reputation: 4611
i have button click handler event in which i am using if-else condition.How can i show a message if it runs to else statement? Like please fill the requirements!!.
Upvotes: 0
Views: 3261
Reputation: 11397
you can use javascript
in .cs
Page.ClientScriptBlock.RegisterStartupScript(Page. GetType(), "Key", "alert('message');", true);
Upvotes: 0
Reputation: 1038730
You could use the RegisterStartupScript method:
ClientScript.RegisterStartupScript(GetType(), "someKey", "alert('oops');", true);
But for this kind of things probably it's better to use validation controls (can't say for sure as you haven't specified any context nor explained the logic).
Upvotes: 2