Home All Groups Group Topic Archive Search About
Author
12 Nov 2007 10:37 PM
Arne Garvander
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

Author
13 Nov 2007 6:04 AM
Manish Bafna
Hi,
Try placing necessary validator controls in the edit template
--
Hope this helps.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



Show quote
"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
Author
13 Nov 2007 3:56 PM
Arne Garvander
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


Show quote
"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
Author
17 Nov 2007 4:34 PM
Phil H
On 13 Nov, 15:56, Arne Garvander
<ArneGarvan***@discussions.microsoft.com> wrote:
Show 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
Author
19 Nov 2007 2:18 PM
Arne Garvander
That doesn't work.
--
Arne Garvander
Certified Geek
Professional Data Dude


Show quote
"Phil H" wrote:

> On 13 Nov, 15:56, Arne Garvander
> <ArneGarvan***@discussions.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
>
Author
21 Nov 2007 7:56 PM
slam radio
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

AddThis Social Bookmark Button