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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top