Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8105245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:06:46+00:00 2026-06-06T00:06:46+00:00

I am trying to display an image in a gridview, however, the columns that

  • 0

I am trying to display an image in a gridview, however, the columns that are being displayed in the gridview are all dynamically displayed(not generated).

I have looked at this post already, but it doesn’t seem to work in my case:
How to access ImageUrl property of the Image Control placed inside a ItemTemplate in the GridView

What I have is a gridview with these columns:

    <Columns> 
        <telerik:GridBoundColumn  HeaderText="Custom1"   HeaderStyle-VerticalAlign="Bottom" DataField="Custom1" SortExpression="Custom1"/>
        <telerik:GridDateTimeColumn HeaderText="Custom2"   HeaderStyle-VerticalAlign="Bottom" DataField="Custom2" SortExpression="Custom2"/>
        <telerik:GridCheckBoxColumn  HeaderText="Custom3"   HeaderStyle-VerticalAlign="Bottom" DataField="Custom3" SortExpression="Custom3"/>
        <telerik:GridTemplateColumn HeaderText="Custom4" HeaderStyle-VerticalAlign="Bottom" DataField="Custom4"><itemtemplate><asp:Image runat="server" ID="Custom4_pic"/></itemtemplate></telerik:GridTemplateColumn>

the four columns are repeated changing the Custom# value until it reaches 48.

I then proceed to hiding all unnecessary columns and only displaying the columns I need.(This is because a user can define the order of the columns to appear, and hardcoding it all was the easiest way I could implement it quickly).

Everything is displayed properly, however, I can’t seem to figure how to set the ImageURL for the image control. For the rest of the columns this is how I am doing it:

dt = new DataTable();
// Do some stuff...
if (aProperty.WebControlType == EntityPropertyWebControlType.CheckboxYN || aProperty.WebControlType == EntityPropertyWebControlType.OptionYN)
{
    dt.Columns.Add("Custom" + ((i * 4) - 1).ToString(), typeof(bool));
    break;
}
else if (aProperty.WebControlType == EntityPropertyWebControlType.Date)
{
    dt.Columns.Add("Custom" + ((i * 4) - 2).ToString(), typeof(DateTime));
    break;
}
else if (aProperty.WebControlType == EntityPropertyWebControlType.Image)
{
    // Not sure what to do here...
    break;
}
else
{
    dt.Columns.Add("Custom" + ((i*4) - 3).ToString(), typeof(string));
    break;
}

// Do more stuff...

// Based on type I will set the values to equal something.. so for example
dr["Custom" + aProperty.LabelColumnNo.ToString()] = "Text" or bool or DateTime
// However I'm not sure what to do for Image...

// and then I return the datatable to be binded to the gridview

Any tips would be great, thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:06:47+00:00Added an answer on June 6, 2026 at 12:06 am

    I have solved the issue.

    I replaced the template columns with GridImageColumns, then in my codebehind, I add Columns to my datatable of type string, I then used an image handler, and set the string to the image handler page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to display image, which is dynamically generated on client side with
So I'm trying to display an image that is ouside the path of my
I am trying to create a wpf control that will display a map image
I am trying to display a GridView in a Dialog. Despite all my efforts,
Im trying to display the image i have coming from an intent.putExtra on a
I trying to display image in picture box. The application have two part. First
Hi everyone I'm trying to display some images using a GridView. However I'm getting
I am trying to display an image on a Frame, however the image doesn't
I'm trying to display image data read in from a binary file (I have
When trying to display image that's adress doesn't exist you will see default browsers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.