Back to Devexpress

FileManagerItem.Name Property

aspnet-devexpress-dot-web-dot-filemanageritem.md

latest4.1 KB
Original Source

FileManagerItem.Name Property

Gets the name of the current item.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
public string Name { get; }
vb
Public ReadOnly Property Name As String

Property Value

TypeDescription
String

A String value that specifies the item’s name.

|

Remarks

The Name property specifies the name of the current item. In order to obtain the full or relative item’s name, use the FileManagerItem.FullName and FileManagerItem.RelativeName property respectively.

Example

The code below demonstrates how you can show information about folder contents in a label.

csharp
public string ItemsNumberToString(int count, string item) {
        if (count != 1) item = item + "s";
        return count.ToString() + " " + item;
}
protected void ASPxFileManager1_Load(object sender, EventArgs e) {
        int FileCount = ASPxFileManager1.SelectedFolder.GetFiles().Length;
        int FolderCount = ASPxFileManager1.SelectedFolder.GetFolders().Length;
        ASPxFileManager1.JSProperties["cpLabelText"] = "The " + ASPxFileManager1.SelectedFolder.Name + " folder contains " + ItemsNumberToString(FolderCount, "folder") + " and " + ItemsNumberToString(FileCount, "file");
}
aspx
<dx:ASPxFileManager ID="ASPxFileManager1" runat="server" ClientInstanceName="fileManager" OnLoad="ASPxFileManager1_Load">
            <Settings RootFolder="~\" ThumbnailFolder="~\Thumb\" />
            <ClientSideEvents EndCallback="function(s, e) {label.SetText(fileManager.cpLabelText);}" />
</dx:ASPxFileManager>

<dx:ASPxLabel ID="ASPxLabel1" runat="server" ClientInstanceName="label">
</dx:ASPxLabel>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Name property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-web-forms-file-manager-azure-custom-provider/CS/DXWebApplication1/AzureFileStorageProvider.cs#L62

csharp
var sourceFolder = GetDirectory(folder.FullName);
    CopyFolderInternal(GetDirectory(folder.FullName), GetDirectory(newParentFolder.FullName), folder.Name);
}

asp-net-web-forms-file-manager-azure-custom-provider/VB/DXWebApplication1/AzureFileStorageProvider.vb#L77

vb
Dim sourceFolder = GetDirectory(folder.FullName)
    CopyFolderInternal(GetDirectory(folder.FullName), GetDirectory(newParentFolder.FullName), folder.Name)
End Sub

See Also

FullName

RelativeName

File Manager

FileManagerItem Class

FileManagerItem Members

DevExpress.Web Namespace