i m developing website in C#.net but my exception message is not displaying in alert box how can i disply my exception in alertbox in try catch any body pls tell me i have tried all of these but n0 result...................

ScriptManager.RegisterStartupScript(this, typeof(Page), "test", "alert('Error - TRANSACTION ROLLED BACK'," + ex.Message + ");", true);


ClientScript.RegisterClientScriptBlock(typeof(Page), "test", "<script>alert('Error - TRANSACTION ROLLED BACK" + ex.Message + "')</script>;");



Response.Write("<script>alert('Error - TRANSACTION ROLLED BACK')</script>" + ex.Message);
kvprajapati commented: Do not flood the forum by posting the same question more than once (ie in multiple forums). -2

Recommended Answers

All 2 Replies

try
        {
            int i = 0;
            int j = 1;
            int k = j / i;
            
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + ex.Message.ToString() + "');", true);
        }

i've checked this one..

hope that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.