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.
