If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > simple control question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-26-08, 13:25
beeyule beeyule is offline
Registered User
 
Join Date: Mar 2004
Posts: 139
simple control question

I'm new to asp.net. I'm using the control below and everything works fine. What I'd like to do though is make the control invisible if the databinder.eval evaluates to null. Right now i

Can anyone assist me with this?

<asp:label id="alternateAccountNumberLabel" style="Z-INDEX: 123; LEFT: 472px; POSITION: absolute; TOP: 64px" runat="server"
Width="80px" Text='<%# DataBinder.Eval(account, "Tables[account].DefaultView.[0].alternate_account_number") %>'
ToolTip="Alternate Account Number"></asp:label>
__________________
Thanks,
Bill
Reply With Quote
  #2 (permalink)  
Old 09-01-08, 05:39
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Have a try with this
Code:
style="

<%
If DataBinder.Eval(account, "Tables[account].DefaultView.[0].alternate_account_number") Is DBNull.Value Then
    Response.Write("display:none;")
End If
%>

z-index: 123; ...
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 09-02-08, 12:26
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
I would do it in the code-behind to prevent the markup from being sent at all.

If this is in an enumerable control (gridview, etc) then you can override the RowDatabound event to evaluate the value of the current gridviewrow and set alternateAccountNumberLabel.visible = false.

That will prevent .NET from even sending the HTML. If you prefer, you could also assign a CssClass that would toggle display:none; if you want the object to be available to manipulate via js etc.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On