Newbie: Problem with usercontrol and webform

  • Thread starter Pablo Apanasionek
  • Start date
P

Pablo Apanasionek

Hey, i'm getting started with ASP.NET and C# and i got into this problem:
I have a user control that works as a header (user information, logo, date,
etc) that has two textboxes and a button, which do the work for user login.
This header persists through the whole webapp. The textboxes are validated
with two required validator controls (user and password).
On the other hand, i have a form that does the user registration (for new
users). The problem arrives when i try to submit this form and there is no
data on the header's textboxes: the req field validators activate and i am
stopped there.

I guess the Click event on the 2nd form is triggering validators on the 1st
one, is there a way to make them independant?

Thanks in advance
Pablo Apanasionek
www.dreamovate.com.ar
 
M

mortb

I think you will have to either expose the validators in the code behid of
the user control so that you can disable them from the page that the control
is on
or expose a function that disables them

codbeind usercontrol:

public void DisableValdators()
{
validator1.Enabled = false;
...
}

webform.aspx:

<uc1:YourUserControl id="loginControl"></uc1:YourUserControl>

code behind webform

protected YourUserControl loginControl;

private Page_Load(object sender, System.EventArgs e)
{
loginControl.DisableValdators();
}

cheers,
mortb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top