Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am able to display alert window with some message.

C#
catch (Exception exc)
            {
                var msg = exc.Message;
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ALERT", "alert('error')", true);
            }


But i want to display the error message(excecptionObject.Message) in alert.
How to do that?

this is working fine



Regards,
Arun
Posted

Hi,

You can write :

C#
catch (Exception ex)
{
Console.WriteLine("{0} Exception caught.", ex);
}


hope it ll solve your problem

Thanks
neha Sharma
 
Share this answer
 
v2
Comments
Arun_Yegi 15-Feb-13 7:56am    
Hi,
Its not a console app.Its an asp.net code behind.
nehas1jan 16-Feb-13 2:23am    
it works in my applications when i want to show alert,try once if you want :)
C#
catch (Exception exc)
{
   var msg = exc.Message;
   Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ALERT", "alert('" + msg + "')", true);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900