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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:39:12+00:00 2026-06-18T02:39:12+00:00

This statement is not working, i want to show default image if there is

  • 0

This statement is not working, i want to show default image if there is no image uploaded pls help

  @if (latestrow.thumb == null)
                     {
                         <img src="~/Images/no-pic.gif"/>
                     }
                     else
                     {
                         <img src="@latestrow.thumb"/>
                     }
  • 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-18T02:39:13+00:00Added an answer on June 18, 2026 at 2:39 am

    There isn’t anything wrong with your code. Assuming latestrow.thumb is null, you’d receive the no-pic.gif.

    My only guess is that latestrow.thumb has some value other than null. Perhaps using this would be a better approach assuming the value of thumb could be blank or null (and assuming it is a string):

    @if (String.IsNullOrEmpty(latestrow.thumb))
    

    If this doesn’t work, check the model being sent to the view and see what’s in that property. Chances are it’s populated with some value, even perhaps a blank space.

    Good luck.

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

Sidebar

Related Questions

I have the a simple LinqToSQL statement that is not working. Something Like this:
Can someone help me understand how to write this case statement properly its not
I have this sql statement: CREATE TABLE [dbo].[User]( [UserId] [int] IDENTITY(1,1) NOT NULL, [FirstName]
For some reason this SQL statement is not working. Can anyone tell me why?
Am I just being blind or does this if statement genuinely not do what
I'm not sure how to approach this SQL statement so please advise, even if
As(no pun intended) you can see in this screenshot the AS statement is not
My if (i>0) statement here is not working, any advice why not? http://jsfiddle.net/qup2R/ I
I am trying to get this jGrowl working but I am not having any
In this case I want to make the code work only if there are

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.