Possible to disable cause validation in button column

calvin

Regular
Joined
Nov 6, 2003
Messages
71
I create a data entry page which contain a lot of textbox and using required field validator. So, when required field is not enter, error message will appear.

My problem is the page also include a datagrid and bind with bound column and button column. The button column combine Edit & Delete button. When click on the button, the required field validator is activate. User cannot perform edit or delete command until all required fields are enter.

How can i set the Causes Validation of Edit/Delete button to "False" since it can be done in form button. I didn't see properties of datagrid allow to set.

Appreciate for those giving comments and help. Thanks

Calvin
 
calvin said:
I create a data entry page which contain a lot of textbox and using required field validator. So, when required field is not enter, error message will appear.

My problem is the page also include a datagrid and bind with bound column and button column. The button column combine Edit & Delete button. When click on the button, the required field validator is activate. User cannot perform edit or delete command until all required fields are enter.

How can i set the Causes Validation of Edit/Delete button to "False" since it can be done in form button. I didn't see properties of datagrid allow to set.

Appreciate for those giving comments and help. Thanks

Calvin

Set the Enable client script for the validation control to false, then in your code create a validation method that is called when you are forwarding the data from processing.

This validation method will firstly call the .Validate() for each validation control. You then need an if statement that check the result.
Code:
'In the code for the button click add the following if statement
if validation = true then
 'no errors do the rest of the processing
else
 'Data missing/incorrect.
 exit sub
end if

'Your validation function
private function validation() as boolean
dim counter as int16
counter = 0

myControl1.validate
myControl2.validate

if myControl1.isvalid = false then
counter = counter +1
endif 
if myControl2.isvalid = false then
counter = counter + 1
end if

if counter > 0 then
validation = false 'there is a problem
elseif counter=0
validation = true
endif
return validation
end function
 
When you submit a page, the validators on the page should be validated. There are two sides to submitting a page: client and server. Microsoft built in support to automatically validate both sides into these submit controls: Button, LinkButton, ImageButton, HtmlInputButton, HtmlButton, and HtmlInputImage. For menus and toolbars, you are on your own.

DES provides support for the standard Microsoft buttons, menus and toolbars. While the system can be hooked up to any third party button, menu or toolbar, here are the controls that have been tested and documented in the User's Guide.
 
I am having a slight problem that hopefully, someone can help me fix.
I have a form on a page. Many items on the form have validation controls
attached.
Also on this form are linkbuttons which must not cause validation. I have
found a setting "causeValidation" to disable the validation.
Also on the page, I have a datagrid that I will edit lines on. I can click
edit and cancel without enforced validation, however, if I click Update, the
validation comes up.
I have tried to put a causesValidation="false" in the linkbutton column on
the datagrid but to no avail.
When I hover over the Update link, I have...
javascript:{if {typeod(Page_ClientValidate) != 'function' ||
Page_ClientValidate()) __doPostback...
in the status bar.
How can I override the Update link to prevent the validation from happening?
Also, if I was to limit just the Update to the datagrid text boxes, how
would I validate those?
A third Q... when in edit mode of the datagrid, how can I use a DropDownList
instead of a text box?.

Thanks.
 
Back
Top