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

How to show file type icon in Radgrid Grid / Attachment column?

4 Answers 486 Views
Grid
This is a migrated thread and some comments may be shown as answers.
gc_0620
Top achievements
Rank 1
gc_0620 asked on 15 Feb 2010, 03:40 AM
Environment: VS 2008 SP1, ASP.NET AJAX 2009 Q3, WIN XP, IE 7.

Demo I am following is from below link.

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/gridattachmentcolumn/defaultcs.aspx

Is it possible to show file type along with uploaded file name in RadGrid. Attached are my modified Radgrid (GridAttachmentcolumnDisplay.JPG) and Windows exploreer source folder (GridAttachmentUploadSourceFolder.JPG) for  Uploaded Files.

What I mean if Document.rtf has a W icon along with file name in exploreer, I would like to display the file in same display format in Radgrid. Currently in Radgrid it shows C:\Documents and Settings\GC\Test\Document.rtf, no icon for file type. Although by double clicking the uploaded file name, it opens with it's appropriate program type. But showing the file type along with file name will be really helpful to users..

In above Telerik Demo, Sushi.pdf or Customer.xls does not show the windows exploreer like file name icon either.

Thanks

gc_0620


4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 17 Feb 2010, 11:47 AM
Hello Ghulam,

RadGrid does not display file icons automatically, because it does not have a database with file types and icons. However, you can easily add icons at runtime in the ItemDataBound event. Here is a similar scenario, which should give you a clue:

https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Common/conditional-image-display-in-gridbuttoncolumn-and-gridtemplatecolumn

Since you will be using ItemDataBound, the image control must be already created (in ItemCreated or declaratively), you will only set the ImageUrl.

And some other relevant information about how to access RadGrid data cell content at runtime:

https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/accessing-values-and-controls/overview

Best wishes,
Dimo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Eyup
Telerik team
answered on 15 Jun 2015, 08:20 AM

Hi,

The first link seems broken. Please try this instead:

https://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/Common/conditional-image-display-in-gridbuttoncolumn-and-gridtemplatecolumn

Regards,
Eyup
Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
SMc
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 13 May 2020, 05:21 PM
That link is dead now too.
0
Dimo
Telerik team
answered on 15 May 2020, 06:34 AM

Hello Sean,

You are right, thanks for reporting the issue.

All the links in this thread are now up-to-date and working. I have also awarded you some Telerik points as a token of gratitude.

Regards,
Dimo
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
gc_0620
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Eyup
Telerik team
SMc
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or