Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 21st, 2007, 12:31 PM
Friend of Wrox
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default Databinding the ImageURL Prop of an Image Control

I've got a TemplateField in a GridView that holds an ASP Image control, and populates it using databinding syntax as follows:

        <asp:Image runat="server" ID="imgImage" Width="80" ImageUrl='<%# DataBinder.Eval ( Container, "DataItem.txtImageName","Images/Store/{0}" ) %>' />
        <div align="center">
            <asp:LinkButton runat="server" ID="lbSelectImage" Text="Select Image" OnClick="btnSelectImage_Click"></asp:LinkButton>
    <ItemStyle Width="100px" HorizontalAlign="Center"></ItemStyle>
        <asp:Image runat="server" ID="imgImage" Width="80" ImageUrl='<%# DataBinder.Eval ( Container, "DataItem.txtImageName","Images/Store/{0}" ) %>' />

For some reason, intermitently, the images all come out blank, and looking at the source shows that all the images' src attributes are set to "", as in src="". This seems to happen when I open this page as a popup from another page.

Thanks in advance for your help. This one is really weird.


  #2 (permalink)  
Old November 22nd, 2007, 12:53 PM
Friend of Wrox
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts

Nevermind. The values in the database were actually null. I can't believe I didn't check that (they're not supposed to be). Just goes to show you, if there is a way for users to enter incomplete data, they always will.




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading Image to Image Control using JavaScript ctranjith General .NET 1 May 28th, 2013 05:43 AM
Eval ImageUrl doesn´t work studioc BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 May 23rd, 2008 05:57 AM
ImageUrl syntax almotions ASP.NET 2.0 Basics 2 January 24th, 2008 03:47 AM
GridView.SelectedIndex Prop SteveP55419 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 October 8th, 2006 09:08 PM

All times are GMT -4. The time now is 05:43 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.