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

Hyperlink column to download or open a file in kendo grid MVC 5 VB.NET

2 Answers 297 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Silver Lightning
Top achievements
Rank 1
Silver Lightning asked on 03 Aug 2014, 11:15 PM
Hi,

Blessed day...

I'm new to telerik here...
just would like to ask on how could I add a hyperlink column (first column) in kendo-grid and by clicking the hyperlink, it provide with the option to download or open file and the second column (2nd) where file size is listed in MB using MVC 5 ASP.NET VB.NET

Here's my initial code below. I would like to change the 'attachment' field as a hyperlink when the user click the hyperlink, the user has an option to download or open a file and the 2nd column is the file size in MB 

Thank you in advance for your help.

My code:

@Code
 
     Html.Kendo().Grid(Of FILEDOWNLOAD.ViewModel.DownloadViewModel.Index)() _
     .Name("gridFileDownload") _
     .Columns(Sub(c)
                      c.Bound(Function(p) p.ID).Width(30).HtmlAttributes(New With {.class = "gridBodyAttribute"})                       
                      c.Bound(Function(p) p.Attachment).Width(250)..Title("Attachment")
                      c.Bound(Function(p) p.FileSize).Width(100).Title("File Size")                      
              End Sub) _
     .Sortable() _
     .Filterable() _
     .Scrollable() _
     .HtmlAttributes(New With {.style = "height:550px;width:100%;"}) _
     .DataSource(Sub(d)
                         d.Ajax() _
                         .PageSize(Session(LocalConstant.Ses_GridPageSize)) _
                         .Model(Sub(model) model.Id(Function(p) p.ID)) _                           
                         .Read(Function(read) read.Action("Download_Read", "FILEDOWNLOAD"))
                 End Sub) _
 .Pageable(Function(pageable) pageable _
 .Refresh(True) _
 .PageSizes(True) _
 .ButtonCount(Session(LocalConstant.Ses_GridButtonCount))).Render()
 
 End Code


 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Madjarov
Telerik team
answered on 04 Aug 2014, 11:26 AM
Hello Jesureno,


You could use the ClientTemplate() method to define a template for the file column and add an action link in it for downloading the file.

Let me know if the information in the documentation is sufficient or I could provide further assistance.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Silver Lightning
Top achievements
Rank 1
answered on 06 Aug 2014, 08:00 AM
Hi Dimiter,

Thank you...
Tags
Grid
Asked by
Silver Lightning
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Silver Lightning
Top achievements
Rank 1
Share this question
or