-
Jun 27th, 2007, 06:42 PM
#1
Thread Starter
Junior Member
[2005] validation in edit mode in a GridView
Hi all,
I have a gridview that can edit data, which is bound to an
sqldatasource. Everything works fine, I can update the data via an Edit
Command field (not in a template field).
However, there are some textboxes in edit mode which I would like to
validate. For example, one of the is required and cannot be left empty.
How can I make such validation in edit mode in a gridview?
Thanks in advance,
Manu
-
Jun 27th, 2007, 07:59 PM
#2
Lively Member
Re: [2005] validation in edit mode in a GridView
are the textboxes in the datagrid itself?
-
Jun 28th, 2007, 01:56 AM
#3
Thread Starter
Junior Member
Re: [2005] validation in edit mode in a GridView
Yes... its in datagrid. But i never place a textbox in datagrid. The bound fields become text box when i clicked update command field.
-
Jun 28th, 2007, 08:30 AM
#4
Re: [2005] validation in edit mode in a GridView
As they're supposed to.
Change the required fields to template fields, and add RequiredFieldValidator controls in each field. Assign the text box as the ControlToValidate for each validator. I'm not sure if VS automatically handles the default update commands with validations... if not, create your own update command and put all your code in a simple if statement:
If Page.IsValid Then
'update
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|