tags:

views:

23

answers:

3

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!!.

+1  A: 

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).

Darin Dimitrov
A: 

you can use javascript in .cs

Page.ClientScriptBlock.RegisterStartupScript(Page. GetType(), "Key", "alert('message');", true);
anishmarokey
A: 
Response.write("javascript:alert('else condition executed');");
Muhammad Akhtar