about UserControl Visible property

E

Edward

hi, everyone,

I've one user control "ctlList" , and one button "View" in the Page, in
the Page_Load event, I set the ctlList.Visible to false, then in the View's
click event, I set it to true.

But the result is when Load , it's really invisible, but Click didn't make
it visible.

where's my fault?

Edward
 
B

Brian

hi, everyone,

I've one user control "ctlList" , and one button "View" in the Page, in
the Page_Load event, I set the ctlList.Visible to false, then in the View's
click event, I set it to true.

But the result is when Load , it's really invisible, but Click didn't make
it visible.

where's my fault?

Edward

perhaps you didn't put the ctlList.Visible = false inside a postback
check (ie
if not ispostback then
ctlList.Visible = false
end if
)

if so then regardless of what happens in the onclick it still sets it
to false when the page loads.

hth,
Brian
 
E

Edward

I did . below is my code:

void Page_Load(Object Sender, EventArgs e) {
if (Page.IsPostBack == false) {
ctlList.Visible = false;
}
}

void btnGenerateInvoice_Click( Object Sender, EventArgs e ) {
ctlList.Visible = true;
}
 
E

Eliyahu Goldin

Edward,

Make sure ctlList has any data to show on the postbacl. If it is databound,
do you re-bind it again on the postback?

Eliyahu
 

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,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top