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

3 posts, 0 answers
  1. gc_0620
    gc_0620 avatar
    246 posts
    Member since:
    Feb 2008

    Posted 14 Feb 2010 Link to this post

    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


  2. Dimo
    Admin
    Dimo avatar
    8457 posts

    Posted 17 Feb 2010 Link to this post

    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:

    http://www.telerik.com/help/aspnet-ajax/grdconditionalimagedisplayingridcolumn.html

    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 and demos about how to access RadGrid data cell content at runtime:

    http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html

    http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx


    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.
  3. Eyup
    Admin
    Eyup avatar
    3867 posts

    Posted 15 Jun 2015 Link to this post

    Hi,

    The first link seems broken. Please try this instead:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/how-to/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
Back to Top