How to use alert box in asp.net and c#

how to use alert box in asp.net and C# with response redirect option.

Thank u

For this we can use Attributes
like
btn.Attributes.Add(“onclick”,“return alert()”);
btn–is the ID of the button on which u want this alert box
and u will be writing this Response.Redirect in button event only
and “btn.Attributes.Add(“onclick”,“return alert()”);”–this line in page init or page load

This might help: http://ajax.asp.net/ajaxtoolkit/ConfirmButton/ConfirmButton.aspx

if you want,there are some code may helps


 Public Function usermessage(ByVal message As String) As String
            Dim script As String
            script = "<script> alert('" + message + "')</script>"
            Response.Write(script)
        End Function

       ' send a message and direct to another page

        Public Overridable Function usermessage(ByVal message As String, ByVal url As String) As String
            Dim script As String
            script = "<script> alert('" + message + "');" + "  window.location.href = '" + url + "'" + "</script>"

            Response.Write(script)

        End Function



this funcation is used to alert some message when page is redriected,

for more, see my space http://jianglin215.spaces.live.com/Blog

try this, load in Windows.Forms, use MessageBox.Show, that’s how i setup my Debug environment.

also you could add a custom control which contains


<script>alert('foo');</script>

or add it to a existing control like


this.label_a.attributes.add("onclick", "alert('foo');")

lots of other posibilities, enjoy

btw, dont use Response.write !!

Why ??