Last post Nov 18, 2015 08:28 AM by Rion Williams
Nov 17, 2015 11:53 AM|dlchase|LINK
<asp:ImageButton ID="IBtnMeal1" runat="server"
ToolTip="Click for larger image"
Height="100" Width="100" />
strImageURL = txtPhotoURL.Text & "Meal" & rowView("MealID").ToString
If Not e.Item.FindControl("IBtnMeal1") Is Nothing Then
ibtn = CType(e.Item.FindControl("IBtnMeal1"), ImageButton)
lbl = CType(e.Item.FindControl("LblMeal1"), Label)
If File.Exists(strVpath & "Meal" & rowView("MealID").ToString & "-1.jpg") Then
ibtn.ImageUrl = strImageURL & "-1.jpg"
lbl.CssClass = "Show"
ibtn.CssClass = "Hide"
lbl.CssClass = "Hide"
We have an asp.net page that uploads images via FileUpload control inside a ListView control. We are uploading, streaming and resizing the image then displaying the image in an ImageButton control. A user asked us if we could show the image "Title" (if any)
in the Tooltip of that image. Is that possible? Below is the ImageButton and the code to populate it from the file system.
Nov 17, 2015 12:27 PM|Rion Williams|LINK
If you have the actual title of the image itself, you can set it via the ToolTip property (or manually through the "title" attribute) as seen below :
IBtnMeal1.ToolTip = "Your Image Title"
IBtnMeal1.Attributes.Add("title","Your Image Title")
Is that what you are referring to?
Nov 17, 2015 12:50 PM|dlchase|LINK
Apparently the user thinks it is an attribute/property of the physical image that is being uploaded. Is that possible? When I view the image in Windows Explorer I can see a "Title" property.
Nov 17, 2015 01:50 PM|Rion Williams|LINK
Is the Title different than that of the file name? If not, you could use something like the Path.GetFileName() method to resolve the actual name of the file and set that as an attribute similar to what was seen above.
Otherwise, I'm not quite sure what the "Title" that your user is referring to means.
Nov 17, 2015 02:20 PM|dlchase|LINK
I wasn't sure either. However, if you click on an image in Windows Explorer, at the bottom of the window it shows a bunch of file attributes (size, date photo taken, etc.) so I think they meant the Title attribute. If you click on it you can enter text.
I have no idea how to access that attribute of an image file, but it is there.
Nov 18, 2015 12:50 AM|Fei Han - MSFT|LINK
Firstly, if you’d like to set ToolTip or title for ImageButton, please refer to
Rion ‘s reply.
Secondly, if you’d like to update/add metadata properties to files, please refer to the following links.
Nov 18, 2015 08:28 AM|Rion Williams|LINK
You would probably need to use a third-party library like one of the ones mentioned in this related thread to access / read those attributes. I would assume that this would allow you to access all of
the EXIF and other metadata in your image file, which you could then use to set your specific tooltip.