User control not visible when setting .Visible = true;

A

Andrea Williams

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;

}

}
 
C

CMA

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

CMA
 
A

Andrea Williams

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
 
A

Andrea Williams

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;

}
 
A

Andrea Williams

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
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top