c# 4.0 – Message box on server side in asp.net – Education Career Blog

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

Leave a Comment