Re: GridView and Page.IsValid

Adam Sills <[email protected]> Mon, 10 Sep 2007 10:29:54 -0500
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <[email protected]>
I think most people (myself included) would like to skip validation because
typically the Delete button should avoid all input validation that is
associated with the current editing row (since you're deleting the row
anyway).

Adam..

-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Mark Brackett
Sent: Monday, September 10, 2007 9:38 AM
To: [email protected]
Subject: [DOTNET-WEB] GridView and Page.IsValid

The GridView seems to check Page.IsValid before handling an Update
(reflected C#):

private void HandleUpdate(GridViewRow row, int rowIndex, bool
causesValidation) {
        if ((!causesValidation || (this.Page == null)) ||
this.Page.IsValid) {
                // ... do update to datasource ... //
        }
}

But not on Delete. It calls Page.Validate() in bool
HandleEvent(EventArgs e, bool causesValidation, string validationGroup),
but only actually checks Page.IsValid in HandleUpdate(). Personally, I
think it should be checking IsValid on both Delete and Edit commands at
a minimum....

This seems like a huge oversight to me - is everyone hooking a handler
to GridView.RowDeleting and setting e.Cancel = !IsValid?

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com