Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Alert Box in Error Handling

Status
Not open for further replies.

imterpsfan3

Programmer
Jul 22, 2005
160
US
I know this is something you usually do in Java Script but not sure how to do it. Whenever I catch an error in a try-catch exception handling, I would like to display the error message and error number in a Java Script alert box.

Something like this:
private void PageLoad(object sender, EventArgs e)
{
//Open database connection
try
{
OpenConnection();
}
catch(SqlException ex)
{
//Display the alert box with error number and
//error message
}
}
 
The solution I came up with involved embedding a javacript block in a response.write statement. That will work fine for me, although there are more elegant solutions out there I'm sure.
 
>>The solution I came up with involved embedding a javacript block in a response.write statement

just one another, there is a method in the Page class for writing out javascript tags called

RegisterClientScriptBlock

try this link:

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top