J
jehugaleahsa
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 DetailsObjectDataSource_Modified(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (e.Exception != null)
{
StringBuilder builder = new StringBuilder();
Exception exception = e.Exception;
while (exception != null)
{
builder.Insert(0, Environment.NewLine);
builder.Insert(0, exception.Message);
exception = exception.InnerException;
}
ScriptManager.RegisterClientScriptBlock(this,
this.GetType(),
"DetailsUpdate",
"Alert('The following error occurred: " +
builder.ToString() + "');",
true);
e.ExceptionHandled = true;
}
OverViewGridView.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 DetailsObjectDataSource_Modified(object sender,
ObjectDataSourceStatusEventArgs e)
{
if (e.Exception != null)
{
StringBuilder builder = new StringBuilder();
Exception exception = e.Exception;
while (exception != null)
{
builder.Insert(0, Environment.NewLine);
builder.Insert(0, exception.Message);
exception = exception.InnerException;
}
ScriptManager.RegisterClientScriptBlock(this,
this.GetType(),
"DetailsUpdate",
"Alert('The following error occurred: " +
builder.ToString() + "');",
true);
e.ExceptionHandled = true;
}
OverViewGridView.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?