[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2008-10-16
5
Medium Priority
?
620 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

656 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