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 3844990
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:10:30+00:00 2026-05-19T16:10:30+00:00

i have a grid with an image column, i want to change images based

  • 0

i have a grid with an image column, i want to change images based on data source.
if data field for a row is 2 then image will be *.gif and if it is 3 then will be different so it is not fixed that which type of images we will have so i want to do “if..else” on css because in that case we can easily change images on css. i don’t want code on code behind file.

  • 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-05-19T16:10:30+00:00Added an answer on May 19, 2026 at 4:10 pm

    CSS does not have any programming constructs such as constants or if / else. There are however several extension to CSS that provide this:

    • xCSS it can nest child elements.

    • Then there’s LESS, it’s written in Ruby so you need that installed (as far as I understand, I haven’t used it myself yet) but it’s perfectly suitable for editing CSS in any environment. Check the “nested rules” section on the front page.

    A simpler solution to your problem is to keep your CSS static, but change the CSS class of your element based on your condition.

    See the following page:

    http://www.w3schools.com/ASPNET/prop_webcontrol_style_cssclass.asp

    e.g. the following button has its style set via the CssClass property:

    <form runat="server">
      <asp:Button id="Button" CssClass="TestStyle" Text="Submit" runat="server"/>
    </form> 
    

    You can of course set this in code-behind based on some logic.

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

Sidebar

Related Questions

I have something like this in my xaml: <Grid> <Image Name=image Source=../../Images/DefaultImage.png HorizontalAlignment=Stretch VerticalAlignment=Stretch></Image>
I have grid of images, when the mouse is over any given image a
In my project I have a grid view which contains images. Based on my
I have a list of images in grid view.I want to display a gallery
I have about 12-15 images that I want to align together in a grid,
I have Grid with 10 rows and 10 column, and I want in code
I am trying to have image column headers in my grid. They sort of
I have an image in a view which contains a 9x9 grid. I want
I have data grid view with columns product name and product image and I
I have a grid, that displays the values in column form. but I want

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.