?
Solved

Validating an embedded user control at the same time as the parent validation

Posted on 2008-10-16
5
Medium Priority
?
618 Views
Last Modified: 2012-05-05
I have a user control that I've drag-and-dropped onto an .aspx page.  Within this user control is a method called Validate.  Because it's possible to drop more than one instance of the user control on this page, the validate method requires the specific name of the instance passed into it... basically it'd be called Validate(NameOfInstance).

Unfortunately, when I click the Submit button on the .aspx page the validation on the .ascx control isn't handled (thus creating the need for the Validate method to begin with).  It seems that ASP.NET, after page load, handles page validation on the client-side without postback.  Thus I don't see a way to tap into the aspx page's Page_Validate handler (if there is even such a thing) to call the user control's Validate method.

I think my approach is to use javascript on the aspx page to call the Validate method of the user control.  I don't mind if it does a postback.  I just need for it to validate everything on the page at once instead of validating everything on the aspx page, then seeing my Validate() call in the button click handler and executing that (so you see one set of red asterisks on the aspx page, then once valid you'll see the red asterisks for the user control).

I hope I've been clear and thank you kindly in advance!
0
Comment
Question by:nmotion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 22

Expert Comment

by:prairiedog
ID: 22767765
Are you using the built-in validators for the user control or the custom validator?
0
 
LVL 1

Author Comment

by:nmotion
ID: 22788708
At the moment I'm using the built-in validators on the user control.  And they're nothing fancy.  Just required field validators.
0
 
LVL 22

Accepted Solution

by:
prairiedog earned 2000 total points
ID: 22789148
If you use built-in validator within the user control itself, it will be fired at the same time with the validation on the ASPX page, and you don't need NameOfInstance, it should know how to handle it by itself.
2008-10-23-133035.jpg
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question