GetFileUrl in custom web part

Chris Thompson asked on December 11, 2014 08:18

I have a page that has a field with the type set as file. I am able to upload a file and using an ASCX transformation call GetFileUrl("{column name}") to get the url to the file.

I am looking to retrieve the file inside of a custom web part. At the moment I can call GetStringValue("{column name}", "") to return the guid but how can I then retrieve the file url?

Correct Answer

Bui Tuong answered on December 11, 2014 10:54

Hi, You can get the file as following:

var url = "~/CMSPages/GetFile.aspx?guid=" + <%#Eval("ColumnName")%>

2 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.