473,626 Members | 3,936 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image Display in gridview

1 New Member
I am making a project which is related to classified web site.
I have used a gridview control. In which put some sqltable data.
And i want to show a image which is store in my project folder,
Whenever grid will display with my sqltabel data + image.
I have created specific folder for every user who send the data.

<div>
<table style="vertical-align:middle; height:100%; width:100%">
<tr>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
<asp:GridView ID="grdImageVie wer" runat="server" AllowPaging="Tr ue" AutoGenerateCol umns="false"
AutoGenerateEdi tButton="false" CellPadding="4" OnPageIndexChan ging ="Page_Load" >
<Columns>
<asp:HyperLinkF ield DataNavigateUrl Fields="Title" DataNavigateUrl FormatString="~/Resume/ResumeDetail.as px?Title={0}"
DataTextField=" Title" HeaderText="Tit le" />


<asp:BoundFie ld DataField="Desc ription" HeaderText="Des cription" />
<asp:BoundFie ld DataField="Emai l" HeaderText="Ema il" />
<asp:TemplateFi eld HeaderText="Ima ge">
<ItemTemplate >
<img alt="Image" src='<%#Eval("g rdImage")%>' />
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
</asp:GridView>
</td>
</tr>
</table>

</div>

cs. file

public partial class Resume_View : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
if (!IsPostBack)
bindData();
//BindDataImage() ;

}

private void bindData()
{
string query = "select Title,Descripti on,Email,ImageP ath from ResumePosting";
DataTable table = DBUser.ExecuteQ uery(query);

if (table.Rows.Cou nt == 0)
return;

int index = 0;

DataTable dt = new DataTable();

dt.Columns.Add( "Title", typeof(string)) ;
dt.Columns.Add( "Descriptio n", typeof(string)) ;
dt.Columns.Add( "Email", typeof(string)) ;
dt.Columns.Add( "grdImage", typeof(string)) ;
DataRow dr;
int imageindex;
string [] file = Directory.GetFi les(Server.MapP ath("~/Resume/Veeru/") + "\\", "*.jpg");
int imagecount = file.Length;
for (index = 0,imageindex=0; index < table.Rows.Coun t; index++,imagein dex++)
{
dr = dt.NewRow();
dr[0] = table.Rows[index]["Title"].ToString();
dr[1] = table.Rows[index]["Descriptio n"].ToString();
dr[2] = table.Rows[index]["Email"].ToString();
dr[3] = ResolveUrl("Thu mbnailCreator.a spx?ImageId=" + file[imageindex]);
dt.Rows.Add(dr) ;
if (imageindex == imagecount-1)
{
imageindex = -1;
}
}
grdImageViewer. DataSource = dt;
grdImageViewer. DataBind();
}

I want to show image related to row which is store in my project forlder.
Feb 16 '08 #1
1 2215
lotus18
866 Contributor
I think this should be posted to a proper forum : )
Feb 16 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5879
by: Tan | last post by:
Hi I am desperate for any help with display image in Gridview I have a gridview contain surname , forename ..... and image. I could not display image as my database store the column image as image not text. I have tried all sort of things like converting the columns image to tempate so on and still could display image
1
2630
by: aabruzzese | last post by:
Hi folks, Been struggling with this little puzzle. I am reading the MemberInfo table for the ClubStarterKit, the table includes the Avatar for the User. I would like to display the Avatar as an image in a databound element, in this case I am resorting to Gridview although I would prefer datalist or something simpler. <code>
3
4136
by: yefei | last post by:
I need to display images in a SQL database using a gridview I search some examples, what they did is very simple add an image field, then set the folowing properties <asp:imagefield dataimageurlfield="LastName" dataimageurlformatstring="~\Images\{0}.jpg" alternatetext="Employee Photo" nulldisplaytext="No image on file." headertext="Photo" readonly="true"/>
1
2537
by: NH | last post by:
ANy ideas on how to acheive this? I want to display a dynamically created image when a mouse over occurs on a gridview event. I need some way of creating the image (it will be a small chart type image) on each rowdatabound event and then display it on a mouse over on the gridview cell. Is it possible?
18
6500
by: Auto | last post by:
Hello, I would like to know how do display an image into a Gridview (ASP.NET 2.0) taken directly from a DataBase, NOT using an URL, like described in this article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/GridViewEx06.asp I have NO URL, i have the binary image inside the DB, like the field "Photo" in the table "Employees" of the "NWIND.MDB" DataBase.
2
3638
by: manmit.walia | last post by:
Hello Fellow Developers, I have a small problem that you might be able to help me with. The method that I am trying to create is the ability to export a GridView and a image to word or excel. I know that some people have already post about this topic but could not find a reliable answer. To my knowledge, I have the code down right. The GridView writes to the word document perfectly just not the image. All I get is a red 'x' image...
0
1491
by: =?Utf-8?B?QnJ5YW4=?= | last post by:
I'm using a GridView to display large search results, and in each row I display a "Select" image button to choose the record. What I've been noticing is that when users search and display the results, the images for the buttons are not displayed all at once, but as if the page was downloading each image one by one, which is an unpleasent look and feel for the users. So, I checked my temporary Internet files and sure enough the same image...
3
1461
by: aSoundMind | last post by:
Hello Guys, I am not sure is this a common problem. I can't display image which in a gridview to excel or word. I have not try on pdf or web but surely this annoy me. I tried to google it and the best I can found is this code which mentioned something tat it is due to excel limitation and so we need to use absolute path.
3
4978
by: Froefel | last post by:
Hi group, I'm looking for some help on how to achieve the following in a gridview control that is based on an ObjectDataSource. The SelectMethod of the datasource returns a list of Customer objects. Each Customer object has a property "Notes". When I display the list of customers in the gridview, I would like to provide a column that displays an Image associated with the Notes property. If the Notes property contains data I want to...
0
8266
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.