Clear data(html) in a usercontrol

B

boomcreation

Hi,

When I load a userControl, I check if I have a variable session.

If my variableSession1 = "A" and do nothing.

but if my variableSession1 = "B", I want clear the html in my control
and write:

"You need to do this or that"

If I use this code:

Current.Session.Abandon()
Current.Response.Write("<TABLE width=""100%"">" & _
"<TR align=""center""><TD><H2>You
need to do this or that"</H2></TD></TR>"
</TABLE>")
Current.Response.End()

all my page is "cleared".

How to clear only the code in my userControl ?

Thanks,
David
 
J

Jeff T

Hi,

When I load a userControl, I check if I have a variable session.

If my variableSession1 = "A" and do nothing.

but if my variableSession1 = "B", I want clear the html in my control
and write:

"You need to do this or that"

If I use this code:

Current.Session.Abandon()
Current.Response.Write("<TABLE width=""100%"">" & _
"<TR align=""center""><TD><H2>You
need to do this or that"</H2></TD></TR>"
</TABLE>")
Current.Response.End()

all my page is "cleared".

How to clear only the code in my userControl ?

Thanks,
David

You can wrap the controls in your UserControl in a PlaceHolder and
then set the PlaceHolder Visible property to true or false depedning
on your session variable. Then you would have another PlaceHolder or
Label for your "Do this" text and use the Visible property on that to
control it as well.
 

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

Top