Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    139

    Unanswered: 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

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    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
    Home | Blog

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    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? ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •