Display Image in Image column depending on another column in GridView - asp.net 2.0

Hi, 

In GridView one of the columns is Document that display a description of the document and
another Column is Image. Depending on the Document it is required to display Image in Image column.

Example: Document is pdf type then display pdf image in Image column
 Document is Film Type then display Film image in Image column.

Think this could be acheived with datarow bound event?

Your help appreciated.

Regards,


-- "Mark As Answer" if my reply helped you --
0
sukumarraju
1/25/2008 12:30:08 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
683 Views

Similar Articles

[PageSpeed] 20

Hi,you can also use the IIF condition.

IIF is a function which compacts a normal
IF condition THEN
  condition_is_true_value
ELSE
  condition_is_false_value
END IF
 

Use document type as a condition  while binding the image.


Shah Dharnendra G
Sr.Analyst Programmer,
GTL-Ahmedabad
0
dharnendra
1/25/2008 1:11:25 PM

Hi dharnendra:

Thanks for your reply. But

Let you know that there is no  need to write any page behind code for this. Below code does simply what is requried.

<asp:TemplateField HeaderText="images">

 

<ItemTemplate>

<asp:Image ID="Image1" runat="server" ImageUrl='<%# "images/" + Eval("DataField") + ".jpg" %>' />

</ItemTemplate>

</asp:TemplateField>


-- "Mark As Answer" if my reply helped you --
0
sukumarraju
1/27/2008 12:39:22 PM

 You can also do it with CSS:

http://pooliestudios.com/projects/iconize/ 

0
IceBreaker
1/27/2008 12:48:28 PM
Reply:

Similar Artilces:

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

display image in Gridview from sql image in .Net 2005
Hi all, I need to Display the Image directly from SQL Database in the GridView as Thumnails. This i can do in .Net 2003 with Help of ItemDatabound Event and Template Column. But in the .Net 2005 there no ItemDatabound event in GridView. For Example I need to Show it like this:  Help Me ASAP.Tamil See :http://www.beansoftware.com/ASP.NET-Tutorials/Images-Database.aspxHope this helps. Vikram.S, DeveloperDiscountASP.NETInnovative ASP.NET Hosting & SQL Hosting Thanks a lot Sharma. It was very useful.  Tamil...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0 #2
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! There are too many differences for one email - - from 1.0 to 1.1 (not a whole lot of real change, other than fixes, at least compared to 1.1 to 2.0) With 2.0, there were many new declarative controls, with many new ideas added in With 3.0, it's a superset of 2.0 - instead of replacing the installation completely, it just 'added on' new functionality - I would...

How to display SQL Server Image column in a Image control in a web formview??
I have a SQL Server 2005 table with a column called WBTImage with a data type as image.  The images were already loaded into the table using a MSAccess program. I want to display the WBTImage column in a asp image control (imgTrain) on a web form.  There is no data binding property for the image column.  I have looked at many posts across many forumns and all of the solutions do not appear to work.  Some used the system.drawing,image.fromstream, some used binary.write, one showed a windows form with a data binding that I could not find and the other used a memorystream...

Displaying images based on data in an image control in a template column in a datagridview
Hi. I'm trying to use a template column in a datagridview such that it displays an image based on a value coming back from the db - eg values 1,2...5 becomes 1star.jpg, 2star.jpg... 5star.jpg I have the column set up with an image control in it. I know I need to set the image control url. I figure I need to do this in a RowDataBound handler...? But have no idea how to reference the image control or the data from the db. Any help appreciated - keep it somple - I've not done HTML\ASP\VB before   Okay found a v simple way            <asp:Temp...

How to manipulate images and combe multiple database columns into one column in a GridView control
Hi Folks,I'm hoping someone can help me out with something.I am trying to put together a photo album as a learning exercise and have a GridView control with two columns linked to an Access Data Source. In the left hand column (called Image) I want to display the photo and in the right hand column (called Details) I want to provide details such as Date, Location, People and Comments, Camera Type etc. Each of these is columns is taken from the database I have set up.However, I have am having some problems:1: At the moment I have been able to get the image to display (using an image column ...

GridView
Hi, How to display Images that are stored in /images folder of ASP.NET 2.0 project in one of the Columns of GridView depending on the Text  coming from Database. In other words Text in the column comes from Database, when the Text in the column is pdf, it is required to display PDF images that is stored in /images folder of ASP.NET project. PLEASE NOTE THERE ARE MORE THAN JUST ONE TEXT AND IMAGE TYPE SUCH AS: When Text in column  is PDF then display /images.pdf.img when Text in Column is FILM then display /images.film.img when Text in column is Worddoc th...

how to create 3(row) x 3(column) column in gridview...nd display images on that from server
hi , I m anil.  i m making a photo album....i m facing a prob in gridview ...how to create 3(row) x 3(column) column in gridview...nd display images on that from server...images are stored in images folder in my application.anyone can tell me how to create and display images on gridview... Hi anilalwaysnear , Something like this :   <form id="form1" runat="server"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSour...

Differences between .net 1, .net 1.1, .net 2.0 and .net 3.0
Hi, This seems to be a common question, but i havent got an answer yet:(Can, any one please explain me the differences between these versions.If you keep your feet firmly on the ground, you'll have trouble putting on your pants! Have a look into this links http://en.wikipedia.org/wiki/.NET_Framework http://blogs.msdn.com/mohammadakif/archive/2006/12/03/net-3-0-different-versions-of-the-net-framework.aspx http://www.codeproject.com/aspnet/ComparisonASP1xASP20.aspAshok Rajawww.iGold.inDon't forget to click "Mark as Answer" on the post that helped you. This credits that m...

Master Details in two seperate GridView Controls
I am simply trying to have a list of people in the top grid control (works fine), then when selected have the second Grid Control show details for that person(not working). Here is what I am trying from the load event: Sub BindData() Dim myConnection As New MySql.Data.MySqlClient.MySqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionSql")) Dim strPersonSQL, strActSQL As String strPersonSQL = "select row_id, first_name, last_name, middle_initial, dsi_id, created, created_by, program_of_study, email from tbl_person" Dim myPerCommand As New MySqlClient.MySqlComm...

how to use map property in image control inasp.net 2.0
 im having an logout image in master page..i need to use map property to logout ..plz its urgent rajesh Dear Rajesh, Use this  <asp:Image id="Image1" runat="server" ImageUrl="~/Images/1.jpg" UseMap="#ImageMap"></asp:Image><MAP NAME="ImageMap">      <AREA SHAPE="RECT" COORDS="110,5,110,17" HREF="SignOut.aspx?logout=true"/></MAP> in SignOut.aspxif (Request.QueryString["logout"] == "true") { FormsAuthenctication.SignOut(); ...

Datagrid(.net 1.1) to GridView(.net 2.0) and using the RowUpdating event how to extract the values from the controls.
Ok  This is the settings: I use a Viewgrid with only itemtemplate colums for example. <asp:TemplateField HeaderText="Test"><ItemTemplate><asp:Label id="LBL_Test" text='<%# DataBinder.Eval(Container.DataItem, "Test1") %>' runat="server" meta:resourcekey="LBL_TestResource1"></asp:Label></font></ItemTemplate> <EditItemTemplate><asp:TextBox ID="HDN_Test" Text='<%# DataBinder.Eval(Container.DataItem, "Test1") %>' Runat="server" meta:resourcekey="HDN_TestResource1" /></EditItemTemplate></asp:TemplateField>  The ...

Issue witht the display color coded columns in the Gridview 2.0 control
Hi There Here's an issue regarding Gridview. I have a Stored Procedure which is actually assigned to display data in Gridview control. On RowDataBound i was basically checking for the columns in the Gridview to Color code them based on condition. The color code doen't display properly for the EditItemTemplates columns.  Let me eloborate a little more, Lets say i have data coming from SP which has couple of coulumns Col1,Col2,Col3,Col4,Col5 out of which Col2 has a Text EditItemTemplate Col3,Col4,Col5 has dropdown EditItemTemplate wherein the data will be populating from different table...

Re: How to control the columns displayed on a .net page depending on the page the user is coming from
  Hi all,    I have got two pages on wy website which contains a form to submit data into the same database. The two pages have also got a link to view the submitted data. The challenge I have got at the moment is, I want to be able to control columns the users see depending on the which of the two pages they are coming from. I know I can simply create two more separate pages but I don't want to do that. I feel I can be clever and achieve this with a conditional statement but to be honest, I don't know how to go about this. Could you please help me on thsi? Bas...

Button image for each top level menu item
For the subpage items I am just going to use background images/styles, but for the top level menu items, I have a button for each one. Just to complicate matters I have a rollover image for each, so when the user's mouse hovers over a given menu item, the button swaps out so they see a different color. Can I do images for the top level menu items? Are rollovers possible as well? How? Appreciate any input. I'm still trying to figure this one out. Has anyone used buttons for their top level menu items? If you could copy the info from your web.sitemap + the css file that would be most help...

Web resources about - Display Image in Image column depending on another column in GridView - asp.net 2.0 - asp.net.presentation-controls

Queensland unemployment rises and falls depending on perspective
Seasonally adjusted rate drops while trend rate shows increase.

Bondi beachfront going cheap – depending on your view
Elevated views of Bondi Beach do not usually come cheap.

Flaws in Chinese retail's great leap forward must be fixed there are lives depending on it
THE leading Chinese business website Caixin has just highlighted a horror story that began a month ago with a delivery by a courier.

Barry O'Sullivan an angel or a demon depending on the party
Depending on what side of the political fence you sat on, Queensland's newest Senator-elect is either an angel or a demon.

Human resistance to malaria varies depending on location, study finds
Humans have evolved different defences against malaria depending on where they live, a study finds.

Takata depending on other companies to make replacement airbag inflators
Nearly 34 million vehicles across North America are affected by Takata's airbag recall

Hours Of Sleep: The Hours Of Snooze You Need, Depending On Your Age (INFOGRAPHIC)
There's a reason why you shouldn't necessarily be sleeping like a baby.

The iPhone forced Google to start over … or not, depending who you believe
... more special coverage of AAPL Company and iOS Devices . What do you think? Discuss "The iPhone forced Google to start over … or not, depending ...


Turns out Kodiak is largest U.S. island, depending on viewpoint
An item from The Associated Press in the Daily News on July 20 quoted former Gov. Sarah Palin identifying Kodiak as "America's largest island." ...

Resources last updated: 12/24/2015 8:56:50 AM