I'm fairly new to this so bear with me!
I have created a gridview in an aspx page which successfully talks to a SQL
backend via a datasource. One of the colums contains a reference to an image
which I display as a column in the grid. This works.
My question is this. Can I make the image into a hyperlink so that when I
click on the image it effectively causes a hyperlink equivalent to the
example below.
TIA
Dave
<A href=""anotherp age.aspx?ID=n"> <img etc...></a>
Where n=the identity value of the ID column. 3 1487
<asp:HyperLinkF ield DataNavigateUrl Fields="ID_Fiel dName"
DataNavigateUrl FormatString="a notherpage.aspx ?id={0}"
Text ="<img src='MyImage.gi f'/>" />
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Dave Bareham" wrote: I'm fairly new to this so bear with me!
I have created a gridview in an aspx page which successfully talks to a SQL backend via a datasource. One of the colums contains a reference to an image which I display as a column in the grid. This works.
My question is this. Can I make the image into a hyperlink so that when I click on the image it effectively causes a hyperlink equivalent to the example below.
TIA
Dave
<A href=""anotherp age.aspx?ID=n"> <img etc...></a>
Where n=the identity value of the ID column.
"Phillip Williams" wrote: <asp:HyperLinkF ield DataNavigateUrl Fields="ID_Fiel dName" DataNavigateUrl FormatString="a notherpage.aspx ?id={0}" Text ="<img src='MyImage.gi f'/>" />
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
Thanks Philip, that kind of helped but the actual file name of the img is
variable and is held in one of the fields in the row.
For example, the source may contain the following fields
ID int identity etc,
Text Field varchar(50),
ImgName varchar(50) , /*E.g.,'iconname .gif' */
OtherFields
How can I make gridview column use the ImgName as the source file name for
the image?
TIA,
Dave
Hi Dave,
You can use the DataTextField property to get the image name from the data
like this:
<asp:HyperLinkF ield DataNavigateUrl Fields="ID_Fiel dName"
DataNavigateUrl FormatString="a notherpage.aspx ?id={0}"
DataTextField=" ImgName" DataTextFieldFo rmatString="<im g src='{0}'/>"/>
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"Dave Bareham" wrote: "Phillip Williams" wrote:
<asp:HyperLinkF ield DataNavigateUrl Fields="ID_Fiel dName" DataNavigateUrl FormatString="a notherpage.aspx ?id={0}" Text ="<img src='MyImage.gi f'/>" />
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
Thanks Philip, that kind of helped but the actual file name of the img is variable and is held in one of the fields in the row.
For example, the source may contain the following fields
ID int identity etc, Text Field varchar(50), ImgName varchar(50) , /*E.g.,'iconname .gif' */ OtherFields
How can I make gridview column use the ImgName as the source file name for the image?
TIA,
Dave This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
by: lanem |
last post by:
I want an image and text in the column header in my GridView. Does anyone
know how to do that? Thanks.
|
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.
|
by: Smokey Grindle |
last post by:
does anyone know of a good example of asp.net 2.0's gridview showing a sort
order arrow in the column header correctly and working? I cant seem to get
what ive found on google to work (see previous post called (sort expression
always = "" in gridview on 6/28/2006)... any help would be great.. thanks!
|
by: Gunawan |
last post by:
Dear All,
I have data which display on the GridView.
GridView contain 3 Column (ProductId, ProductCode and Description).
I would like to display only Product Code and Description so I hide
ProductId Column.
Is there any command so I can take value of first column which is Product
ID?
In other words, how can I get value from hidden column on Grid View?
TIA,
| |
by: Dale |
last post by:
This seems like it should be simple and I am pretty sure I've done similar
things a hundred times before but I sure can't seem to get it right this time.
I have a GridView with a column of text boxes. If I want to position an
image over the GridView just below, for instance, the textbox in row 4 of the
GridView. I don't care that it covers the other textboxes. I am
successfully obtaining the textbox and the image objects in client-side...
|
by: Beemer Biker |
last post by:
I have a 10 row (per page) gridview where the first column is a small image
under 100x200px and the second column is a DropDownList template that
selects which image to show in the first column. This works, but I noticed
that when I click the DDL and select another image, all the images on the
page get refreshed. There are as few as 3 images and not more than 7 per
row. Worst case would be 7x10 = 70 small images that need to be loaded....
|
by: TimmyTurner |
last post by:
Hi all,
I am trying to view an image from the database in the gridview control.
I set up my SQLDatasource, and when testing the query i can see the images in the preview table,
then i add a gridview control, add a new column, and select Image Field, and then my DataField, which is of type "Image".
The problem is the only option i have is to select the "URL format string" and the "Image Data" option is not there, so the image does not...
|
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...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |