code within control declaration

  • Thread starter Thread starter Daves
  • Start date Start date
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?
 
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...
 
Back
Top