Setting the default image.

Posted on 2011-10-13
Last Modified: 2013-12-16

Is the below code works?
Is there a better approach?

Your idea is greatly appreciated.
<img src="<%# if(String.IsNullOrEmpty(DataBinder.Eval(Container.DataItem, "ImageURL")),"/_layouts/images/blank.gif", DataBinder.Eval(Container.DataItem, "ImageURL") ) %>" title="<%# DataBinder.Eval(Container.DataItem, "ImageAltText") %>" alt="<%# DataBinder.Eval(Container.DataItem, "ImageAltText") %>" />

Open in new window

Question by:PagodNaUtak
    1 Comment
    LVL 7

    Accepted Solution

    Only other way is to create a databound user object...

    This would be overkill if you aren't going to reuse that particular tag a lot.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now