User controls problem.

Discussion in 'ASP .Net Building Controls' started by Josema, Jan 18, 2005.

  1. Josema

    Josema Guest

    Hi,

    Im starting to do the navigation of a portal, and for it, im using
    usercontrols....

    Actually i have a user control in the top of the page that has some menus
    (contact, register, etc...)

    Depending of the menu that the user will clik i make a LoadControl to the
    specific user control. i start to see some problems following this way...

    If the control to load doesnt have any controls that makes post-back (a
    button, or any control with autopostback=true) it works, cause when i make
    click in a menu, i show the user control, and that's all.

    But if the user control for instance its a form to register a user here
    comes the problem, cause when i click the button the control is loaded, but
    if i fill the form to register, and click in the button of this form, this
    user control dissapear...

    I know the reason cause i make the LoadControl in the Onlclick Method of the
    menu, and if i click in in the button that is in the user control of the
    register this control its not loaded cause the program dont go throught the
    Onclick Method of the menu...

    How could i solve it?

    I Hope explain my self correctly...
    --
    Thanks
    Regards.
    Josema
     
    Josema, Jan 18, 2005
    #1
    1. Advertising

  2. Josema

    CMA Guest

    Hi Josema,

    this is only a guess. you have a problem with page initializing. mean with
    the method called "page_load".

    in this method what you are doing. if you re generate the page when post
    back.. it hide your control.

    you can overcome this problem with "IsPostBack".

    example:

    page_load(..)
    {
    if(!IsPostBack)
    {
    // do your work here.. only for the first time page load
    }
    }

    please post some code fragment to give the exact solution...

    hope this helps,

    regards,
    CMA


    "Josema" <> wrote in message
    news:...
    > Hi,
    >
    > Im starting to do the navigation of a portal, and for it, im using
    > usercontrols....
    >
    > Actually i have a user control in the top of the page that has some menus
    > (contact, register, etc...)
    >
    > Depending of the menu that the user will clik i make a LoadControl to the
    > specific user control. i start to see some problems following this way...
    >
    > If the control to load doesnt have any controls that makes post-back (a
    > button, or any control with autopostback=true) it works, cause when i make
    > click in a menu, i show the user control, and that's all.
    >
    > But if the user control for instance its a form to register a user here
    > comes the problem, cause when i click the button the control is loaded,

    but
    > if i fill the form to register, and click in the button of this form, this
    > user control dissapear...
    >
    > I know the reason cause i make the LoadControl in the Onlclick Method of

    the
    > menu, and if i click in in the button that is in the user control of the
    > register this control its not loaded cause the program dont go throught

    the
    > Onclick Method of the menu...
    >
    > How could i solve it?
    >
    > I Hope explain my self correctly...
    > --
    > Thanks
    > Regards.
    > Josema
    >
     
    CMA, Jan 19, 2005
    #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. trinitypete

    HTML Controls and User controls

    trinitypete, Jun 25, 2003, in forum: ASP .Net
    Replies:
    6
    Views:
    3,427
    trinitypete
    Jun 26, 2003
  2. Axel Dahmen
    Replies:
    1
    Views:
    519
    Teemu Keiski
    Nov 12, 2003
  3. Nathan Sokalski
    Replies:
    4
    Views:
    1,156
    Muhammad Naveed Yaseen
    Sep 5, 2007
  4. Faizan Ahmed
    Replies:
    1
    Views:
    302
    John Saunders
    Jan 4, 2005
  5. Faizan Ahmed
    Replies:
    1
    Views:
    378
    John Saunders
    Jan 4, 2005
Loading...

Share This Page