hey everyone,
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!!.
hey everyone,
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!!.
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).
you can use javascript
in .cs
Page.ClientScriptBlock.RegisterStartupScript(Page. GetType(), "Key", "alert('message');", true);
Response.write("javascript:alert('else condition executed');");