|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
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 You will have to handle the Page level Error event:
http://msdn2.microsoft.com/en-us/library/ed577840.aspx Show quoteHide quote "kai" wrote: > 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 Show quoteHide quote "Phillip Williams" <WEBSWAPP@newsgroups.nospam> wrote in message news:0BEA7BC2-9CB9-4A2A-8B48-4FB5E981433B@microsoft.com... > 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: > >> 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 >> >> >> 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); Show quoteHide quote "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... > > 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: > > > >> 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. Kai Show quoteHide quote "Phillip Williams" <WEBSWAPP@newsgroups.nospam> wrote in message news:1429C506-8A12-4D32-A536-914A519CFE42@microsoft.com... > 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... >> > 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: >> > >> >> 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 >> >> >> >> >> >> >> >> >>
Master Detail Event Handling?
Date masked textbox for user input ASP.NET 2.0 Databind during Client Callback How to turn off padding within a Web Part? Problem with FindControl DropDownList resets selectedIndex on postback Strange behavior with gridview and selectedindex need help in web user control Hide show asp table Absolute Positioning in Web User Controls |
|||||||||||||||||||||||