Last post Oct 22, 2013 11:07 AM by fonio
Aug 07, 2007 05:09 AM|SpoBo|LINK
I have been trying to translate an image that is used by a Select commandfield in my gridview. I'd like to do it the 'asp.net way' and place my Image in a Global .resx file. After that I'm sort of stuck since I have no clue where to set the translation for
the CommandField. Is there a simple way in the editor? And if not ... what's the best alternate way?
on RowDataBound ? But if I do that I can't seem to convert my e variable to a CommandField :s
If e.Row.RowType = DataControlRowType.DataRow Then
Dim cf As CommandField = CType(e.Row.Cells(3).Controls(0), CommandField)
Aug 08, 2007 07:27 AM|SpoBo|LINK
It's pretty sad that there is no easy way to translate an image on a CommandField in a GridView ... either I'm missing some buttons in my VS2005 version or it's just not possible. So I ended up placing a Resource like the following: "<img src='images/knop-kies.jpg'
style='border:none;' />" and used this as the SelectText property and set the type to Link. That does it ... but in a very ugly way. If anyone can come up with a better (cleaner) solution I'll give you the answer checkmark.
Oct 22, 2013 11:07 AM|fonio|LINK
in case of ButtonType="Image"
<asp:CommandField ShowSelectButton="True" SelectImageUrl="img/xxx.gif" ButtonType="Image" SelectText="Sélectionner" />
on RowDataBound :
Dim ib As ImageButton = CType(e.Row.Cells(7).Controls(0), ImageButton)ib.ImageUrl = "img/monImage.gif"