Get document from GUID

Mateusz Żebrowski asked on July 11, 2014 08:01

I'm developing my own new Web Part. Here is my .ascx code:

<%@ Register Src="~/CMSModules/Content/FormControls/Documents/SelectDocument.ascx" TagPrefix="uc1" TagName="SelectDocument" %>
<uc1:SelectDocument runat="server" ID="Selector" ClientIDMode="Static" />
<asp:Button ID="Add" runat="server" Text="Add next" OnClick="Add_Click"/>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>

Now after click the label should display 'DocumentName' of selected document. Document Selector Value is GUID so the problem is how to get document when we have it's GUID?

Recent Answers

Joshua Adams answered on July 11, 2014 10:20

Create a method that takes in a GUID and returns a string for the name. You will need to retrieve the document using the API(Different in version 7 and 8). In 8 you could use the documenthelper class possibly, otherwise, you could event just grab a dataset and set the where condition to where to doc guid = control.selectedvalue or however you store it.

0 votesVote for this answer Mark as a Correct answer

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