User control not visible when setting .Visible = true;

Discussion in 'ASP .Net Web Controls' started by Andrea Williams, Jan 26, 2004.

  1. I'm working with c#, my code is below. The page starts out showing just a
    dropdown and a button. When the dropdown is selected and the button is
    pressed, it's supposed to show the user controls, however, even though the
    code sets it to be visible again, it's still not visible. I have run
    through the code with the debugger and the code is being executed, but
    nothing shows up on the page. Any ideas?

    Thanks,
    Andrea

    protected CIS.controls.ucFrmSubmission UcFrmSubmission1;

    protected CIS.controls.ucFrmAuthors ucFrmAuthors1;

    private void InitializeComponent()

    {

    m_strNumOfAuthors = Request.Form.Get("selNumOfAuthors");

    if (m_strNumOfAuthors == null)

    {

    UcFrmSubmission1.Visible = false;

    ucFrmAuthors1.Visible = false;

    }

    else

    {

    UcFrmSubmission1.Visible = true;

    ucFrmAuthors1.Visible = true;

    }

    }
    Andrea Williams, Jan 26, 2004
    #1
    1. Advertising

  2. Andrea Williams

    CMA Guest

    can u put the code into Page_Load() event and see... dont put codes in
    initialize section...

    CMA



    "Andrea Williams" <> wrote in message
    news:%23zzp%...
    > I'm working with c#, my code is below. The page starts out showing just a
    > dropdown and a button. When the dropdown is selected and the button is
    > pressed, it's supposed to show the user controls, however, even though the
    > code sets it to be visible again, it's still not visible. I have run
    > through the code with the debugger and the code is being executed, but
    > nothing shows up on the page. Any ideas?
    >
    > Thanks,
    > Andrea
    >
    > protected CIS.controls.ucFrmSubmission UcFrmSubmission1;
    >
    > protected CIS.controls.ucFrmAuthors ucFrmAuthors1;
    >
    > private void InitializeComponent()
    >
    > {
    >
    > m_strNumOfAuthors = Request.Form.Get("selNumOfAuthors");
    >
    > if (m_strNumOfAuthors == null)
    >
    > {
    >
    > UcFrmSubmission1.Visible = false;
    >
    > ucFrmAuthors1.Visible = false;
    >
    > }
    >
    > else
    >
    > {
    >
    > UcFrmSubmission1.Visible = true;
    >
    > ucFrmAuthors1.Visible = true;
    >
    > }
    >
    > }
    >
    >
    CMA, Jan 27, 2004
    #2
    1. Advertising

  3. I've tried putting the code in the Page_Load event, but nothing owrked when
    the code was there. Things don't hide or appear.

    Andrea


    "CMA" <> wrote in message
    news:...
    > can u put the code into Page_Load() event and see... dont put codes in
    > initialize section...
    >
    > CMA
    >
    >
    >
    > "Andrea Williams" <> wrote in message
    > news:%23zzp%...
    > > I'm working with c#, my code is below. The page starts out showing just

    a
    > > dropdown and a button. When the dropdown is selected and the button is
    > > pressed, it's supposed to show the user controls, however, even though

    the
    > > code sets it to be visible again, it's still not visible. I have run
    > > through the code with the debugger and the code is being executed, but
    > > nothing shows up on the page. Any ideas?
    > >
    > > Thanks,
    > > Andrea
    > >
    > > protected CIS.controls.ucFrmSubmission UcFrmSubmission1;
    > >
    > > protected CIS.controls.ucFrmAuthors ucFrmAuthors1;
    > >
    > > private void InitializeComponent()
    > >
    > > {
    > >
    > > m_strNumOfAuthors = Request.Form.Get("selNumOfAuthors");
    > >
    > > if (m_strNumOfAuthors == null)
    > >
    > > {
    > >
    > > UcFrmSubmission1.Visible = false;
    > >
    > > ucFrmAuthors1.Visible = false;
    > >
    > > }
    > >
    > > else
    > >
    > > {
    > >
    > > UcFrmSubmission1.Visible = true;
    > >
    > > ucFrmAuthors1.Visible = true;
    > >
    > > }
    > >
    > > }
    > >
    > >

    >
    >
    Andrea Williams, Jan 27, 2004
    #3
  4. The .Visible Property isn't working on the Div tags either. Same Problem
    with the Visible property, except, see the code below. I start out with two
    of the div tages visible and a third not. Then on postback and the number
    of authors is not null, I want to make the first two invisible and the thrid
    one visible. But on postback, none of them are visible.

    I also have tried using a Label instead of the DIV tag, but it doesn't work
    properly either.

    This is weird... I just made a change, then refreshed the already posted
    page, and the div tag showed up. Then I went 'back' in the browser to
    before the post back and refreshed, then submitted the form again, and the
    div tag was missing again.... Am I having som sort of server caching
    problem?

    Andrea

    m_strNumOfAuthors = Request.Form["selNumOfAuthors"];

    if (m_strNumOfAuthors == null)

    {

    divFormInstructions1.Visible = true;

    divNumOfAuthors.Visible = true;

    divFormInstructions2.Visible = false;

    }

    else

    {

    divFormInstructions1.Visible = false;

    divNumOfAuthors.Visible = false;

    divFormInstructions2.Visible = true;

    }

    "Andrea Williams" <> wrote in message
    news:%23zzp%...
    > I'm working with c#, my code is below. The page starts out showing just a
    > dropdown and a button. When the dropdown is selected and the button is
    > pressed, it's supposed to show the user controls, however, even though the
    > code sets it to be visible again, it's still not visible. I have run
    > through the code with the debugger and the code is being executed, but
    > nothing shows up on the page. Any ideas?
    >
    > Thanks,
    > Andrea
    >
    > protected CIS.controls.ucFrmSubmission UcFrmSubmission1;
    >
    > protected CIS.controls.ucFrmAuthors ucFrmAuthors1;
    >
    > private void InitializeComponent()
    >
    > {
    >
    > m_strNumOfAuthors = Request.Form.Get("selNumOfAuthors");
    >
    > if (m_strNumOfAuthors == null)
    >
    > {
    >
    > UcFrmSubmission1.Visible = false;
    >
    > ucFrmAuthors1.Visible = false;
    >
    > }
    >
    > else
    >
    > {
    >
    > UcFrmSubmission1.Visible = true;
    >
    > ucFrmAuthors1.Visible = true;
    >
    > }
    >
    > }
    >
    >
    Andrea Williams, Jan 28, 2004
    #4
  5. I found the problem.... Somehow the InitializeComponent function wwas
    changed and it caused the issues that I was seeing. It probably happened
    when I was doing a copy paste and VS.NET went wacky. I seem to be getting a
    bug that messes up the Copy Paste functionality in VS.NET 2003 quite
    frequently.. The only thing to fix the problem is to close VS and
    re-open... I haven't been able to pin point why it goes into this funk
    though...

    Andrea


    "Andrea Williams" <> wrote in message
    news:%23zzp%...
    > I'm working with c#, my code is below. The page starts out showing just a
    > dropdown and a button. When the dropdown is selected and the button is
    > pressed, it's supposed to show the user controls, however, even though the
    > code sets it to be visible again, it's still not visible. I have run
    > through the code with the debugger and the code is being executed, but
    > nothing shows up on the page. Any ideas?
    >
    > Thanks,
    > Andrea
    >
    > protected CIS.controls.ucFrmSubmission UcFrmSubmission1;
    >
    > protected CIS.controls.ucFrmAuthors ucFrmAuthors1;
    >
    > private void InitializeComponent()
    >
    > {
    >
    > m_strNumOfAuthors = Request.Form.Get("selNumOfAuthors");
    >
    > if (m_strNumOfAuthors == null)
    >
    > {
    >
    > UcFrmSubmission1.Visible = false;
    >
    > ucFrmAuthors1.Visible = false;
    >
    > }
    >
    > else
    >
    > {
    >
    > UcFrmSubmission1.Visible = true;
    >
    > ucFrmAuthors1.Visible = true;
    >
    > }
    >
    > }
    >
    >
    Andrea Williams, Jan 28, 2004
    #5
    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. Andreas Klemt
    Replies:
    0
    Views:
    646
    Andreas Klemt
    Jan 15, 2004
  2. spamfurnace
    Replies:
    1
    Views:
    2,624
    Scott M.
    May 24, 2004
  3. Nick Stansbury
    Replies:
    6
    Views:
    464
    Nick Stansbury
    Apr 11, 2005
  4. Replies:
    0
    Views:
    804
  5. bdb112
    Replies:
    45
    Views:
    1,318
    jazbees
    Apr 29, 2009
Loading...

Share This Page