code within control declaration

D

Daves

I'd like to have a control visible/not visible based on some value eg:
<asp:Button ID="Button1" runat="server" Text="Change" Visible=<%
Membership.GetUser("david").IsOnline >% />

doesn't seem to work, do I maybe have to set the Visible property from
codebehind?
 
C

Craig Deelsnyder

I'd like to have a control visible/not visible based on some value eg:
<asp:Button ID="Button1" runat="server" Text="Change" Visible=<%
Membership.GetUser("david").IsOnline >% />

doesn't seem to work, do I maybe have to set the Visible property from
codebehind?

Looks like a few typos, I assume you're trying to databind here; Visible
attribute should look like:

Visible='<%# Membership.GetUser("david").IsOnline %>'

and make sure you call .DataBind() on the textbox at the appropriate
time...
 

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,774
Messages
2,569,598
Members
45,159
Latest member
SweetCalmCBDGummies
Top