This is a migrated thread and some comments may be shown as answers.

ImageButton showing 'Submit Query'

4 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 08 Jul 2011, 11:16 AM
I have an imagebutton column:
<telerik:GridButtonColumn CommandName="MyCommand" ButtonType="ImageButton" UniqueName="ViewNote">
      </telerik:GridButtonColumn>

The image is not displaying, but 'Submit Query'.

I read somewhere this was because the URL was wrong, however my URL to the image is the same as the URL's to all the images on that page.

Any ideas?

If (TypeOf e.Item Is GridDataItem) Then
            Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
            If (dataItem("FileStatus").Text = "Requested") Then
                dataItem.ForeColor = Drawing.Color.Crimson
                dataItem.Font.Bold = True
                CType(dataItem("ViewNote").Controls(0), ImageButton).ImageUrl = "../images/time_icon.jpg"
            Else
                dataItem("ViewNote").Controls(0).Visible = False
            End If
        End If

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Jul 2011, 12:11 PM
Hello Andrew,

This issue arises when you have not set the folder path correctly. Check the following forum thread which discussed similar scenario.
ImageButton in FireFox says "Submit Query" instead of rendering the button on initial load.

Thanks,
Princy.
0
Andrew
Top achievements
Rank 1
answered on 08 Jul 2011, 12:46 PM
Ok images are now showing but I only want to show the icon if the column has data in it?

How would I modify this code to check if there is data in it. If true - display icon, if not show no icon

If (TypeOf e.Item Is GridDataItem) Then
            Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
            If (dataItem("FileStatus").Text = "Requested") Then
                dataItem.ForeColor = Drawing.Color.Crimson
                dataItem.Font.Bold = True
                CType(dataItem("ViewNote").Controls(0), ImageButton).ImageUrl = "../images/time_icon.jpg"
            Else
                dataItem("ViewNote").Controls(0).Visible = False
            End If
        End If
0
Andrew
Top achievements
Rank 1
answered on 08 Jul 2011, 07:37 PM
Can anyone help me please?
0
Heera
Top achievements
Rank 1
answered on 03 Jun 2017, 07:03 AM
This Problem also will be occured when we use upgrade version in visual studio and web config lower version value set
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Andrew
Top achievements
Rank 1
Heera
Top achievements
Rank 1
Share this question
or