Newbie: Problem with usercontrol and webform

Discussion in 'ASP .Net Web Controls' started by Pablo Apanasionek, Dec 8, 2004.

  1. 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
    Pablo Apanasionek, Dec 8, 2004
    #1
    1. Advertising

  2. Pablo Apanasionek

    mortb Guest

    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


    "Pablo Apanasionek" <> wrote in message
    news:uqv$...
    > 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
    >
    >
    mortb, Dec 9, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. titof
    Replies:
    0
    Views:
    496
    titof
    Jul 24, 2003
  2. timmso
    Replies:
    1
    Views:
    478
    Alex Papadimoulis
    Dec 12, 2003
  3. =?Utf-8?B?bXN1aw==?=

    Using one webform to set a value on another webform

    =?Utf-8?B?bXN1aw==?=, Jul 12, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    456
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jul 12, 2006
  4. =?Utf-8?B?Vk1J?=

    Moving value from popup Webform to main Webform?

    =?Utf-8?B?Vk1J?=, Oct 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    570
    GroupReader
    Oct 9, 2006
  5. kirkski

    MasterPage, UserControl and Webform

    kirkski, May 12, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    219
    Teemu Keiski
    May 12, 2007
Loading...

Share This Page