Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8656829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:22:31+00:00 2026-06-12T15:22:31+00:00

I have some tabular data, when the label has some specific value I need

  • 0

I have some tabular data, when the label has some specific value I need to make it show off.
Trying to do by styling the TD.
My C# sets the value for Label1.text

Can you think of any other way for doing so? It’s throwing ambiguity error.

 <% if (Label1.Text == "1") { %>
            <td style="background:#ffedad; border:#e3a345; color:#cd5c0a"><asp:Label ID="Label1" runat="server" /></td>
 <% }  else {%>
      <td><asp:Label ID="Label1" runat="server" /></td>
 <% } %>

EDIT

Did something else (and cleaner).

Worked on some code behind variables along with some new td.alt on my css file to get the value of the label. If it’s 1, then I set a
classLabel variable to alt and then I just set the class inside the td

<td class="<%classLabel%>"><asp:Label ID="Label1" runat="server" /></td>

Still, I’m getting and error on this last line in my aspx page, any ideas where the error is?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:22:33+00:00Added an answer on June 12, 2026 at 3:22 pm

    You can try this with a single line :

    <td <%=Label1.Text != "1"?"":"style='background:#ffedad; border:#e3a345; color:#cd5c0a'"%>><asp:Label ID="Label1" runat="server" /></td>
    

    Setting the style code behind and with a css class would be cleaner IMHO

    Hope this will help

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some tabular data which has a lot of fields in it, and
I have some tabular data with some functionality to view details that fires off
I have some data loaded as a np.ndarray and need to convert it to
I have some code that will change the background color of a specific label
I have a web-site that generates some simple tabular data as html tables, many
I have to display some tabular data where there is a maximum of 3
I have a PDF file containing some tabular data. http://dl.dropbox.com/u/44235928/sample_rotate-0.pdf I have to extract
I have 3 sets of tabular data I want to display with a JavaScript
I have some tabular data: Foo Bar ------------- fooes 42 bars 666 ... So,
Say you have some tabular data you want to display, as well as allow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.