Home > Archive > ASP .NET Webcontrols > January 2006 > How to Catch exception for GridView control?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to Catch exception for GridView control?
|
|
|
| Hi,
I placed a Gridview control on a ASP.NET 2.0 page and enabled the
"Delete", "Edit" . I want to do "Try Catch" on "Delete" and "Edit" button in
the GridView but don't find the place to put the code. Please help.
Thanks!
Kai
| |
|
|
|
| Phillip ,
Thanks for your help.
I went to the > http://msdn2.microsoft.com/en-us/library/ed577840.aspx
and use the code:
private void Page_Error(object sender, EventArgs e)
{
Response.Write("An application error has been logged.");
ApplicationSpecificErrorLogger(Server.GetLastError().Message);
Server.ClearError();
}
I found error for not recogonizing "ApplicationSpecificErrorLogger". I
looked it in help file and not find the class.
What I did is using GridView to display "Phone Number", and a front user
can edit the number. I setup phone number datatype vchar(20). When user
enter longer than 20 characters, error message will show. Try/Catch cannot
catch the exception.
Kai
"Phillip Williams" <WEBSWAPP@newsgroups.nospam> wrote in message
news:0BEA7BC2-9CB9-4A2A-8B48-4FB5E981433B@microsoft.com...[color=darkred]
> You will have to handle the Page level Error event:
> http://msdn2.microsoft.com/en-us/library/ed577840.aspx
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "kai" wrote:
>
| |
| Phillip Williams 2006-01-28, 7:05 pm |
| The function named ApplicationSpecificErrorLogger is not part of the .net
framework. If you had read the "Compiling the Code" section of that article,
it reads:
"This example requires: An ASP.NET Web page. An error-logging function that
is specific to your application."
For the purpose of your testing, you could have simply written:
Response.Write (Server.GetLastError().Message);
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"kai" wrote:
> Phillip ,
> Thanks for your help.
> I went to the > http://msdn2.microsoft.com/en-us/library/ed577840.aspx
>
> and use the code:
>
> private void Page_Error(object sender, EventArgs e)
> {
> Response.Write("An application error has been logged.");
> ApplicationSpecificErrorLogger(Server.GetLastError().Message);
> Server.ClearError();
> }
>
> I found error for not recogonizing "ApplicationSpecificErrorLogger". I
> looked it in help file and not find the class.
>
> What I did is using GridView to display "Phone Number", and a front user
> can edit the number. I setup phone number datatype vchar(20). When user
> enter longer than 20 characters, error message will show. Try/Catch cannot
> catch the exception.
>
> Kai
>
>
> "Phillip Williams" <WEBSWAPP@newsgroups.nospam> wrote in message
> news:0BEA7BC2-9CB9-4A2A-8B48-4FB5E981433B@microsoft.com...
>
>
>
| |
|
| Phillip,
Thanks.
Kai
"Phillip Williams" <WEBSWAPP@newsgroups.nospam> wrote in message
news:1429C506-8A12-4D32-A536-914A519CFE42@microsoft.com...[color=darkred]
> The function named ApplicationSpecificErrorLogger is not part of the .net
> framework. If you had read the "Compiling the Code" section of that
> article,
> it reads:
> "This example requires: An ASP.NET Web page. An error-logging function
> that
> is specific to your application."
>
> For the purpose of your testing, you could have simply written:
>
> Response.Write (Server.GetLastError().Message);
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "kai" wrote:
>
|
|
|
|
|