Is your page located in the root directory of your web app? Because
the following line:

<img id="DataList1_ctl00_Image1"
src="App_Data/Images/Fotolia_4181499_XS.jpg" style="border-width:0px;"
/>

Looks for a folder /App_Data/ within the current folder. If you are
located at a lower level, the image won't be found.

Also can you access the uploaded files by typing the whole url into
your browser, i.e. what happens when you type

http://localhost/mysite/App_Data/Images/Fotolia_4181499_XS.jpg

into your browsers address bar? (obviously using the correct server
and site name)


On Tue, Mar 16, 2010 at 1:51 PM, Alen Alexander <[email protected]> wrote:
>
> OK the code is as follows:
> <table id="DataList1" cellspacing="0" 
> border="0" style="border-color:#CC66FF;border-style:Groove;border-collapse:collapse;">
> <tr>
> <td>
> picurl:
> <img id="DataList1_ctl00_Image1" src="App_Data/Images/Fotolia_4181499_XS.jpg" 
> style="border-width:0px;" />
> <br />
> uploadedby:
> <span id="DataList1_ctl00_uploadedbyLabel">Alen</span>
> <br />
> <br />
> </td><td>
> picurl:
> <img id="DataList1_ctl04_Image1" src="App_Data/Images/04.jpg" 
> style="border-width:0px;" />
> <br />
> uploadedby:
> <span id="DataList1_ctl04_uploadedbyLabel">Alex</span>
> <br />
> <br />
> </td>
> </tr><tr>
> <td>
> picurl:
> <img id="DataList1_ctl01_Image1" src="App_Data/Images/06.jpg" 
> style="border-width:0px;" />
> <br />
> uploadedby:
> <span id="DataList1_ctl01_uploadedbyLabel">Raun</span>
> <br />
> <br />
> </td><td>
> picurl:
> <img id="DataList1_ctl05_Image1" 
> src="App_Data/Images/business_people_presentation.jpg" 
> style="border-width:0px;" />
> <br />
> uploadedby:
> <span id="DataList1_ctl05_uploadedbyLabel">Ajoe</span>
> <br />
> <br />
> </td>
> </tr><tr>
> <td>
> picurl:
> <img id="DataList1_ctl02_Image1" src="App_Data/Images/CMSTEAM.jpg" 
> style="border-width:0px;" />
> <br />
> uploadedby:
> <span id="DataList1_ctl02_uploadedbyLabel">master</span>
> <br />
> <br />
> </td><td>
> picurl:
> <img id="DataList1_ctl06_Image1" 
> src="App_Data/Images/business_people_presentation.jpg" 
> style="border-width:0px;" />
> <br />
> uploadedby:
> <span id="DataList1_ctl06_uploadedbyLabel">Ajoe</span>
> <br />
> <br />
> </td>
> </tr><tr>
> <td>
> picurl:
> <img id="DataList1_ctl03_Image1" src="App_Data/Images/04.jpg" 
> style="border-width:0px;" />
> <br />
> uploadedby:
> <span id="DataList1_ctl03_uploadedbyLabel">Joe</span>
> <br />
> <br />
> </td><td>
> picurl:
> <img id="DataList1_ctl07_Image1" src="App_Data/Images/cms.jpg" 
> style="border-width:0px;" />
> <br />
> uploadedby:
> <span id="DataList1_ctl07_uploadedbyLabel">Alen</span>
> <br />
> <br />
> </td>
> </tr>
> </table>
> On Tue, Mar 16, 2010 at 2:40 PM, Jamie Fraser <[email protected]> wrote:
>>
>> Hmm...
>>
>> 1) Fire up your web browser
>> 2) Navigate to the relevant page
>> 3) Move the mouse over the page
>> 4) Right Click
>> 5) Choose "View Source"
>> 6) In notepad, find the relevant <img src="..." /> tag
>> 7) Copy and paste it here
>>
>> :o)
>>
>>
>>
>> On Mon, Mar 15, 2010 at 10:16 AM, Alen Alexander <[email protected]> wrote:
>>>
>>> Sorry Jamie!! i am not getting what you are asking.. I gave u the code of 
>>> Image tag.
>>>
>>> On Mon, Mar 15, 2010 at 3:13 PM, Jamie Fraser <[email protected]> 
>>> wrote:
>>>>
>>>> Sorry - I'll try and be really clear:
>>>>
>>>> On the rendered page (in your Web Browser) what is the rendered HTML 
>>>> markup for the <img> tag?
>>>>
>>>> On Mon, Mar 15, 2010 at 9:00 AM, Alen Alexander <[email protected]> 
>>>> wrote:
>>>>>
>>>>> The Source code is as follows:
>>>>> <ItemTemplate>
>>>>>                 picurl:<asp:Image ID="Image1" runat="server" 
>>>>> ImageUrl='<%# Eval("picurl","~/App_Data/Images/{0}") %>' />
>>>>>                 <br />
>>>>>                 uploadedby:
>>>>>                 <asp:Label ID="uploadedbyLabel" runat="server"
>>>>>                     Text='<%# Eval("uploadedby") %>' />
>>>>>                 <br />
>>>>>                 <br />
>>>>> </ItemTemplate>
>>>>> Each image shows the name of person whoo uploaded the image correctly. 
>>>>> But image is not being displayed.
>>>>> On Mon, Mar 15, 2010 at 2:25 PM, Jamie Fraser <[email protected]> 
>>>>> wrote:
>>>>>>
>>>>>>  Sorry, I meant if you view source, what is the actual <img> tag?
>>>>>>
>>>>>> On Fri, Mar 12, 2010 at 5:57 PM, Alen Alexander <[email protected]> 
>>>>>> wrote:
>>>>>>>
>>>>>>> it shows the default image (the small icon of image )
>>>>>>>
>>>>>>> On Fri, Mar 12, 2010 at 8:10 PM, Jamie Fraser <[email protected]> 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> When the page is renedered, what does the <img> tag actually show?
>>>>>>>>
>>>>>>>> On Fri, Mar 12, 2010 at 12:10 PM, Alen Alexander <[email protected]> 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Thanks for your response!!
>>>>>>>>> The Images are stored in a folder named "Images" which is inside 
>>>>>>>>> App_Data.
>>>>>>>>> The code for DataList with the SQLDatasource is as follows:
>>>>>>>>> The changes I made has been highlighted.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> <asp:SqlDataSource ID="SqlDataSource1" runat="server"
>>>>>>>>>             ConnectionString="<%$ 
>>>>>>>>> ConnectionStrings:DatabaseConnectionString %>"
>>>>>>>>>             DeleteCommand="DELETE FROM [gallery] WHERE [pid] = @pid"
>>>>>>>>>             InsertCommand="INSERT INTO [gallery] ([picurl], 
>>>>>>>>> [uploadedby]) VALUES (@picurl, @uploadedby)"
>>>>>>>>>             SelectCommand="SELECT [pid], [picurl], [uploadedby] FROM 
>>>>>>>>> [gallery]"
>>>>>>>>>
>>>>>>>>>             UpdateCommand="UPDATE [gallery] SET [picurl] = @picurl, 
>>>>>>>>> [uploadedby] = @uploadedby WHERE [pid] = @pid">
>>>>>>>>>             <DeleteParameters>
>>>>>>>>>                 <asp:Parameter Name="pid" Type="Int32" />
>>>>>>>>>             </DeleteParameters>
>>>>>>>>>             <UpdateParameters>
>>>>>>>>>                 <asp:Parameter Name="picurl" Type="String" />
>>>>>>>>>                 <asp:Parameter Name="uploadedby" Type="String" />
>>>>>>>>>                 <asp:Parameter Name="pid" Type="Int32" />
>>>>>>>>>             </UpdateParameters>
>>>>>>>>>             <InsertParameters>
>>>>>>>>>                 <asp:ControlParameter Name="picurl" Type="String" 
>>>>>>>>> ControlID="FileUpload1" PropertyName="FileName" />
>>>>>>>>>                 <asp:ControlParameter Name="uploadedby" Type="String" 
>>>>>>>>> ControlID="TextBox1" PropertyName="text" />
>>>>>>>>>             </InsertParameters>
>>>>>>>>>         </asp:SqlDataSource>
>>>>>>>>>         <br />
>>>>>>>>>         <br />
>>>>>>>>>         <br />
>>>>>>>>>         <br />
>>>>>>>>>         <asp:DataList ID="DataList1" runat="server" 
>>>>>>>>> DataSourceID="SqlDataSource2">
>>>>>>>>>             <ItemTemplate>
>>>>>>>>>                 picurl:<asp:Image ID="Image1" runat="server" 
>>>>>>>>> ImageUrl='<%# Eval("picurl","~/App_Data/Images/{0}") %>' />
>>>>>>>>>                 <br />
>>>>>>>>>                 uploadedby:
>>>>>>>>>                 <asp:Label ID="uploadedbyLabel" runat="server"
>>>>>>>>>                     Text='<%# Eval("uploadedby") %>' />
>>>>>>>>>                 <br />
>>>>>>>>>                 <br />
>>>>>>>>>             </ItemTemplate>
>>>>>>>>>         </asp:DataList>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Mar 12, 2010 at 2:43 PM, Jamie Fraser 
>>>>>>>>> <[email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>> If the images are getting saved correctly, then you probably don't 
>>>>>>>>>> need to post the code that saves the images!
>>>>>>>>>>
>>>>>>>>>> Could you post the markup and any codebehind for your DataList?
>>>>>>>>>>
>>>>>>>>>> On Thu, Mar 11, 2010 at 12:14 PM, Alen Alexander 
>>>>>>>>>> <[email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Frnds,
>>>>>>>>>>> I am trying to create a photo gallery website.
>>>>>>>>>>> In the web page i hav a DataList control which has Image control to 
>>>>>>>>>>> display existing images from database.
>>>>>>>>>>> The problem is that images are not displayed.
>>>>>>>>>>> The Code is as follows:
>>>>>>>>>>> protected void Button1_Click(object sender, EventArgs e)
>>>>>>>>>>>     {
>>>>>>>>>>>         string imagefolder = "App_Data\\Images";
>>>>>>>>>>>         string savepath;
>>>>>>>>>>>         string savefile;
>>>>>>>>>>>         if (FileUpload1.HasFile)
>>>>>>>>>>>         {
>>>>>>>>>>>             savepath = 
>>>>>>>>>>> Path.Combine(Request.PhysicalApplicationPath, imagefolder);
>>>>>>>>>>>             savefile = Path.Combine(savepath, FileUpload1.FileName);
>>>>>>>>>>>             FileUpload1.SaveAs(savefile);
>>>>>>>>>>>             SqlDataSource1.Insert();
>>>>>>>>>>>             //DataList1.DataBind();
>>>>>>>>>>>             Label2.Text = "Successfully uploaded";
>>>>>>>>>>>         }
>>>>>>>>>>>     }
>>>>>>>>>>> The images are getting saved into the destined folder but not 
>>>>>>>>>>> displaying in DataList.
>>>>>>>>>>> Can anyone help me out?
>>>>>>>>>>> Thanks a lot.
>>>>>>>>>>> --
>>>>>>>>>>> Alen
>>>>>>>>>>>
>>>>>>>>>>> Just remember, there's a right way and a wrong way to do everything,
>>>>>>>>>>> And the wrong way is to keep trying to make everybody else do it 
>>>>>>>>>>> the right way.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Alen
>>>>>>>>>
>>>>>>>>> Just remember, there's a right way and a wrong way to do everything,
>>>>>>>>> And the wrong way is to keep trying to make everybody else do it the 
>>>>>>>>> right way.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Alen
>>>>>>>
>>>>>>> Just remember, there's a right way and a wrong way to do everything,
>>>>>>> And the wrong way is to keep trying to make everybody else do it the 
>>>>>>> right way.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Alen
>>>>>
>>>>> Just remember, there's a right way and a wrong way to do everything,
>>>>> And the wrong way is to keep trying to make everybody else do it the 
>>>>> right way.
>>>>
>>>
>>>
>>>
>>> --
>>> Alen
>>>
>>> Just remember, there's a right way and a wrong way to do everything,
>>> And the wrong way is to keep trying to make everybody else do it the right 
>>> way.
>>
>
>
>
> --
> Alen
>
> Some people have hundreds of reason why they cannot do what they want to,
> when all they need is one reason why they can!!!!

Reply via email to