Hello:
I am going through an effort to standardize web applications for my
company. We are trying to figure out the best practices for security,
error handling, etc. I've just done a large amount of work to figure
out the built-in ASP .NET security features (which was fairly easy to
do). So now I am tackling error handling.
What we would like to do is show a JavaScript Alert box with the error
information in it. Here is the code I wished worked (but it doesn't):
protected void DetailsObjectDa taSource_Modifi ed(object sender,
ObjectDataSourc eStatusEventArg s e)
{
if (e.Exception != null)
{
StringBuilder builder = new StringBuilder() ;
Exception exception = e.Exception;
while (exception != null)
{
builder.Insert( 0, Environment.New Line);
builder.Insert( 0, exception.Messa ge);
exception = exception.Inner Exception;
}
ScriptManager.R egisterClientSc riptBlock(this,
this.GetType(),
"DetailsUpdate" ,
"Alert('The following error occurred: " +
builder.ToStrin g() + "');",
true);
e.ExceptionHand led = true;
}
OverViewGridVie w.DataBind();
}
How can I relay a message to the user via an Alert box?
Another question: We have issues with data here such that our
DropDownLists are regularly throwing exceptions. What is the best way
to indicate to a user that a value in a drop down list is invalid and
*must* be changed? How do you prevent the DDL from throwing an
exception? or how do you prevent it from killing the application?
I am going through an effort to standardize web applications for my
company. We are trying to figure out the best practices for security,
error handling, etc. I've just done a large amount of work to figure
out the built-in ASP .NET security features (which was fairly easy to
do). So now I am tackling error handling.
What we would like to do is show a JavaScript Alert box with the error
information in it. Here is the code I wished worked (but it doesn't):
protected void DetailsObjectDa taSource_Modifi ed(object sender,
ObjectDataSourc eStatusEventArg s e)
{
if (e.Exception != null)
{
StringBuilder builder = new StringBuilder() ;
Exception exception = e.Exception;
while (exception != null)
{
builder.Insert( 0, Environment.New Line);
builder.Insert( 0, exception.Messa ge);
exception = exception.Inner Exception;
}
ScriptManager.R egisterClientSc riptBlock(this,
this.GetType(),
"DetailsUpdate" ,
"Alert('The following error occurred: " +
builder.ToStrin g() + "');",
true);
e.ExceptionHand led = true;
}
OverViewGridVie w.DataBind();
}
How can I relay a message to the user via an Alert box?
Another question: We have issues with data here such that our
DropDownLists are regularly throwing exceptions. What is the best way
to indicate to a user that a value in a drop down list is invalid and
*must* be changed? How do you prevent the DDL from throwing an
exception? or how do you prevent it from killing the application?
Comment