Monday, March 26, 2012

Validation across multiple DetailsViews

I have a page with a gridview that drives 3 detailsviews. I have validations for each individual detailsview, however I do not know how to check across all 3 unless I change the mode to Edit before I run my check. I cannot figure out how to write it where it will only open the form to edit when I make my final selection that will trigger my last validation. Any ideas? Here is some of my code:

Sub PreCompletedCheck(ByVal senderAs Object,ByVal eAs System.EventArgs)

ContractDetails.ChangeMode(DetailsViewMode.Edit)

Dim MSGLabelAs Label

Dim StatusAs DropDownList

Status = RequestDetail.FindControl("Status")

Dim ContractReleasedDateAsDate

If Status.SelectedValue ="COMPLETED"Then

If ContractReleasedDate.Date =""Then

MSGLabel = ContractDetails.FindControl("Date_Contract_Released")

MSGLabel.Text ="Required"

EndIf

End If

EndSub

Hi:

jaf0416:

I have validations for each individual detailsview, however I do not know how to check across all 3 unless I change the mode to Edit before I run my check. I cannot figure out how to write it where it will only open the form to edit when I make my final selection that will trigger my last validation.

Could you describe in detail? I could not understand what do you mean. Anyway based on my experience, two questions here:

1. Have you tried setting CausesValidation = false for your buttons?

2. Have you used ValidationGroup?

Take a look at our tutorial to get started:

RequiredFieldValidator

RangeValidator

RegularExpressionValidator

CompareValidator

CustomValidator

ValidationSummary

Thanks

No comments:

Post a Comment