| | |
image problem in datalist
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Aug 2007
Posts: 33
Reputation:
Solved Threads: 0
Hi All
I am working since 2 days to display images in a datalist and the code used is given below, but its not displaying the images.
I am storing path of the image in database in imagepath cooumn. Kindly help me please.
html code
---------------
<asp
ataList ID="dlImage" runat="server" RepeatColumns="3" Width="311px" Height="334px">
<ItemTemplate>
<asp:ImageButton ID="imgPhotos" ImageUrl='<%#Eval("imagepath")%>' Height="100%" Width="100%" runat="server" />
</ItemTemplate>
</asp
ataList>
c# code
----------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cnOledb = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=" + strRootDir + "App_Data\\dbPhotos.mdb");
cnOledb.Open();
string strSelImages = "select imagepath from tblPhotos";
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(strSelImages, cnOledb);
da.Fill(ds);
dlImage.DataSource = ds.Tables[0];
dlImage.DataBind();
cnOledb.Close();
}
}
Thanks
wajid
I am working since 2 days to display images in a datalist and the code used is given below, but its not displaying the images.
I am storing path of the image in database in imagepath cooumn. Kindly help me please.
html code
---------------
<asp
ataList ID="dlImage" runat="server" RepeatColumns="3" Width="311px" Height="334px"><ItemTemplate>
<asp:ImageButton ID="imgPhotos" ImageUrl='<%#Eval("imagepath")%>' Height="100%" Width="100%" runat="server" />
</ItemTemplate>
</asp
ataList>c# code
----------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cnOledb = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=" + strRootDir + "App_Data\\dbPhotos.mdb");
cnOledb.Open();
string strSelImages = "select imagepath from tblPhotos";
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(strSelImages, cnOledb);
da.Fill(ds);
dlImage.DataSource = ds.Tables[0];
dlImage.DataBind();
cnOledb.Close();
}
}
Thanks
wajid
•
•
Join Date: Mar 2008
Posts: 61
Reputation:
Solved Threads: 1
•
•
•
•
Hi All
I am working since 2 days to display images in a datalist and the code used is given below, but its not displaying the images.
I am storing path of the image in database in imagepath cooumn. Kindly help me please.
html code
---------------
<aspataList ID="dlImage" runat="server" RepeatColumns="3" Width="311px" Height="334px">
<ItemTemplate>
<asp:ImageButton ID="imgPhotos" ImageUrl='<%#Eval("imagepath")%>' Height="100%" Width="100%" runat="server" />
</ItemTemplate>
</aspataList>
c# code
----------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cnOledb = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=" + strRootDir + "App_Data\\dbPhotos.mdb");
cnOledb.Open();
string strSelImages = "select imagepath from tblPhotos";
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(strSelImages, cnOledb);
da.Fill(ds);
dlImage.DataSource = ds.Tables[0];
dlImage.DataBind();
cnOledb.Close();
}
}
Thanks
wajid
the image as a binary in database or ,
you save the image in front end and save the image path in database ,
if u reply for this i will help u out ,
because i to use this type in c# ,
so reply me soon ,i will reply u tomarrow ok ,,,
cool
![]() |
Similar Threads
- image not displayed in datalist (ASP.NET)
- Problems using a php generator (PHP)
Other Threads in the ASP.NET Forum
- Previous Thread: Using a Timer Control
- Next Thread: problem related to DropDownList, AutoPostBack
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox child class compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownmenu dynamic dynamically edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv form gridview gudi iis javascript list listbox menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order parent problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security select serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview typeof validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xsl





