SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot SuperFunZoo's Avatar
    Join Date
    Feb 2004
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Display images in DataControls

    Problem solved...



    Morning,


    I have built an upload function in VS 2003 with Persits AspUpload and AspJpeg that stores the filename in the database, just the name not the actual image, the image itself is stored on the servers harddrive.
    When I try to retrieve the images and display them in a DataGrid, DataList or Repeater, it will not display the images, even if the url is correct.

    Shouldn't the code below this work or am I missing something here...?
    <img src='_upload/Graphics/<&#37;# DataBinder.Eval(Container.DataItem, "ImageFile") %>'>

    And the code to display it in a DataList...

    Code Csharp:
    private void LoadGallery()
    {
        SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
        SqlCommand comm = new SqlCommand("GetGallery", conn);
        SqlDataReader reader;
     
        try
        {
            conn.Open();
            reader = comm.ExecuteReader();
            list.DataSource = reader;
            list.DataBind();
            reader.Close();
        }
        catch(Exception ex)
        {
            throw ex;
        }
        finally
        {
            conn.Close();
        }
    }

    Any ideas?
    Last edited by SuperFunZoo; Nov 2, 2007 at 04:26.

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Try <&#37;# DataBinder.Eval(Container.DataItem, "ImageFile", "~/_upload/Graphics/{0}") %>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •