Alert box in ASP.NET

Hey,

how can i show the user a popup alert box fir a certain behavior?

lets say i have this code:-


            if ()
            {
//Do something here
            }
            else
            {
                //Alert box here
            }

how can i get this alert box to work?

Its a bit easier to understand if I know what you are trying to do. But, this is usually done in javascript. including the if, etc.

But if you want to do it from server side. You have to use the RegisterClientScriptBlock methods. I cannot remember the methods names exactly as I have not done it in many years. But that should get you on the right track

You can use
Protected void on_Click(object o,sender s)
{
//C# Code behind…
//Some operations
Page.ClientScript.RegisterClientScriptBlock(GetType(),“PopUp”, “<script>alert(‘Som Alert Messages.’);</script>”);
}