HighTechTalks DotNet Forums  

Gridview error handling

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss Gridview error handling in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Arne Garvander
 
Posts: n/a

Default Gridview error handling - 11-12-2007 , 04:37 PM






I have a gridview control that is updateable. One of the data elements is
date, which is very easy to misstype. An invalid date will throw an error. Is
there a way to handle that error in a neat and clean manner?
--
Arne Garvander
Certified Geek
Professional Data Dude

Reply With Quote
  #2  
Old   
Manish Bafna
 
Posts: n/a

Default RE: Gridview error handling - 11-13-2007 , 12:04 AM






Hi,
Try placing necessary validator controls in the edit template
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



"Arne Garvander" wrote:

Quote:
I have a gridview control that is updateable. One of the data elements is
date, which is very easy to misstype. An invalid date will throw an error. Is
there a way to handle that error in a neat and clean manner?
--
Arne Garvander
Certified Geek
Professional Data Dude

Reply With Quote
  #3  
Old   
Arne Garvander
 
Posts: n/a

Default Gridview error handling Date + time - 11-13-2007 , 09:56 AM



Thanks for the tip.
I can get the validator to validate a date, but if I add time to the date,
the validator will missfire.
In a regular form I can validate a date+time, but not in a gridview template.

--
Arne Garvander
Certified Geek
Professional Data Dude


"Manish Bafna" wrote:

Quote:
Hi,
Try placing necessary validator controls in the edit template
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



"Arne Garvander" wrote:

I have a gridview control that is updateable. One of the data elements is
date, which is very easy to misstype. An invalid date will throw an error. Is
there a way to handle that error in a neat and clean manner?
--
Arne Garvander
Certified Geek
Professional Data Dude

Reply With Quote
  #4  
Old   
Phil H
 
Posts: n/a

Default Re: Gridview error handling Date + time - 11-17-2007 , 10:34 AM



On 13 Nov, 15:56, Arne Garvander
<ArneGarvan... (AT) discussions (DOT) microsoft.com> wrote:
Quote:
Thanks for the tip.
I can get the validator to validate a date, but if I add time to the date,
the validator will missfire.
In a regular form I can validate a date+time, but not in a gridview template.

--
Arne Garvander
Certified Geek
Professional Data Dude



"Manish Bafna" wrote:
Hi,
Try placing necessary validator controls in the edit template
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"Arne Garvander" wrote:

I have a gridview control that is updateable. One of the data elements is
date, which is very easy to misstype. An invalid date will throw an error. Is
there a way to handle that error in a neat and clean manner?
--
Arne Garvander
Certified Geek
Professional Data Dude- Hide quoted text -

- Show quoted text -
The alternative is to place validation code in the
GridView.RowUpdating event. There you can use DateTime parsing and any
other checks you wish to make. If the validation fails then the event
argument e (GridViewUpdateEventArgs.Cancel) can be used to abort the
update and return the grid to the edit view (using label controls for
error messages).

HTH


Reply With Quote
  #5  
Old   
Arne Garvander
 
Posts: n/a

Default Re: Gridview error handling Date + time - 11-19-2007 , 08:18 AM



That doesn't work.
--
Arne Garvander
Certified Geek
Professional Data Dude


"Phil H" wrote:

Quote:
On 13 Nov, 15:56, Arne Garvander
ArneGarvan... (AT) discussions (DOT) microsoft.com> wrote:
Thanks for the tip.
I can get the validator to validate a date, but if I add time to the date,
the validator will missfire.
In a regular form I can validate a date+time, but not in a gridview template.

--
Arne Garvander
Certified Geek
Professional Data Dude



"Manish Bafna" wrote:
Hi,
Try placing necessary validator controls in the edit template
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.

"Arne Garvander" wrote:

I have a gridview control that is updateable. One of the data elements is
date, which is very easy to misstype. An invalid date will throw an error. Is
there a way to handle that error in a neat and clean manner?
--
Arne Garvander
Certified Geek
Professional Data Dude- Hide quoted text -

- Show quoted text -

The alternative is to place validation code in the
GridView.RowUpdating event. There you can use DateTime parsing and any
other checks you wish to make. If the validation fails then the event
argument e (GridViewUpdateEventArgs.Cancel) can be used to abort the
update and return the grid to the edit view (using label controls for
error messages).

HTH


Reply With Quote
  #6  
Old   
slam radio
 
Posts: n/a

Default gridview date + time error handling - 11-21-2007 , 01:56 PM



Try this, it works!

Private Sub GridView1_RowUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs ) Handles gvSchedule.RowUpdated
If e.Exception IsNot Nothing Then
ErrorMessageLabel.Text = e.Exception.Message
e.ExceptionHandled = True
e.KeepInEditMode = True
End If
End Sub

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.