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

FileExplorer OpenFile Minimize/Maximize controls

4 Answers 195 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Tomaž Lovrec
Top achievements
Rank 1
Tomaž Lovrec asked on 12 May 2010, 09:35 AM
Hi,

I would like to enable the Minimize/Maximize buttons on the RadWindow which has the opened document from the RadFileExplorer. So far, I was able to set FileExplorer.WindowManager.InitialBehavior to maximize, which maximizes the window, but there's a problem.
When opening a PDF document the RadFileExplorer in the back is "visible" over the document as 2 white squares(see attachment). Even so if I get rid of this problem, I would still like to implement Min/Max buttons. But I do not know how. :S

Best regards,
Thomas

4 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 12 May 2010, 05:02 PM
Hi Tomaž,

If you want to add maximize and minimize behaviors, you should set all desired behaviors to the Behavior property, e.g.

RadFileExplorer.WindowManager.Behavior = WindowBehaviors.Maximize | WindowBehaviors.Minimize | WindowBehaviors.Close;

I opened a pdf file with RadFileExplorer and everything seems to be fine. If you think that the problem is related to the RadFileExplorer, please send us some additional information (screenshots,pdf file, source code) which will help us to reproduce the issue locally.

Best regards,

Petio Petkov
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.
0
Tomaž Lovrec
Top achievements
Rank 1
answered on 13 May 2010, 11:51 AM
Thank you so much, I have managed to get those Min/Max buttons, but the other problem still exists.

You can see the screenshot above in my first post. In the top of the file, there should be some text, but it's whitened out. A little lower you can see a table with a red header, half of the header is also invisible, and that's the exact location of where RadFileExplorer is on the page.
It doesn't matter which PDF file I open, it's all the same.

And here is the code:
.aspx:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="datoteke.aspx.cs" Inherits="datoteke" Title="Untitled Page" %> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"
 
<script type="text/javascript"
    function OnClientFolderLoaded(sender, args) { 
        var radExplorer = $find('<%= FileExplorer1.ClientID %>'); 
        var getGrid = radExplorer.get_grid(); 
 
        var table = getGrid.get_masterTableView(); 
        var rows = table.get_dataItems(); 
        for (var i = 0; i < rows.length; i++) { 
            var row = rows[i]; 
            var sizeInBytes = row.get_cell("Size").innerHTML; 
            var inegerValue = -1; 
            try { 
                inegerValue = parseInt(sizeInBytes); 
            } 
            catch (err) { 
                inegerValue = -1; 
            } 
            if (inegerValue > 0) { 
                var textInKB = Math.round(inegerValue / 1024); 
                if (textInKB >= 1000) { 
                    textInKB = Math.round(textInKB / 1024); 
                    if (textInKB < 1textInKB = 1
                    textInKBtextInKB = textInKB + " MB"; 
                } 
                else { 
                    if (textInKB < 1textInKB = 1
                    textInKBtextInKB = textInKB + " KB"; 
                } 
                row.get_cell("Size").innerHTML = textInKB
            } 
        } 
    } 
</script> 
 
<div style="text-align:center;"
    <center> 
    <telerik:RadFileExplorer ID="FileExplorer1" runat="server" 
        EnableCreateNewFolder="true" Language="sl-SI" 
        DisplayUpFolderItem="true" EnableOpenFile="true" Width="1065px" OnClientFolderLoaded="OnClientFolderLoaded" 
        VisibleControls="AddressBox,Grid,Toolbar,TreeView,ContextMenus" 
            OnClientLoad="OnClientFolderLoaded" TreePaneWidth="300px" Skin="Sunset"
        <Configuration ViewPaths="~/DOKUMENTI" UploadPaths="~/DOKUMENTI"  
            DeletePaths="~/DOKUMENTI" MaxUploadFileSize="104857600" /> 
    </telerik:RadFileExplorer> 
    </center> 
</div> 
</asp:Content> 
 
 

.aspx.cs:
using System; 
using System.Collections; 
using System.Configuration; 
using System.Data; 
using System.Linq; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.HtmlControls; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Xml.Linq; 
using Telerik.Web.UI; 
using System.Collections.Generic; 
using Telerik.Web.UI.Widgets; 
using System.IO; 
 
public partial class datoteke : WebPage 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        // ČE NIMA PRAVICE ZA PREGLED 
        if (Get_UserPravica(this.AppRelativeVirtualPath + "/" + "VIEW") == -1) 
            Response.Redirect("~/login.aspx"); 
                     
 
 
        RadToolBar toolBar = FileExplorer1.ToolBar; 
        // Remove commands from the ToolBar control;   
        int i = 0; 
        while (i < toolBar.Items.Count) 
        { 
            //if (Get_UserPravica(this.AppRelativeVirtualPath + "/" + "SODELAVEC_IZBIRA") != -1) 
             
            if (toolBar.Items[i].Value == "Delete" && Get_UserPravica(this.AppRelativeVirtualPath + "/" + "DATOTEKE_DELETE") == -1) 
            { 
                toolBar.Items.RemoveAt(i); 
                continue// Next item   
            } 
            else if (toolBar.Items[i].Value == "Upload" && Get_UserPravica(this.AppRelativeVirtualPath + "/" + "DATOTEKE_UPLOAD") == -1) 
            { 
                toolBar.Items.RemoveAt(i); 
                continue// Next item   
            } 
            else if (toolBar.Items[i].Value == "NewFolder" && Get_UserPravica(this.AppRelativeVirtualPath + "/" + "DATOTEKE_NEWFOLDER") == -1) 
            { 
                toolBar.Items.RemoveAt(i); 
                continue// Next item   
            } 
 
            i++;// Next item   
        } 
         
 
        if (!IsPostBack) 
        { 
            //Set initial folder to open. Note that the path is case sensitive! 
            FileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomColumnsContentProvider).AssemblyQualifiedName; 
            FileExplorer1.InitialPath = Page.ResolveUrl("~/DOKUMENTI/"); 
 
            GridTemplateColumn gtc = new GridTemplateColumn(); 
            gtc.HeaderText = "Datum kreiranja"
            gtc.DataField = gtc.SortExpression = gtc.UniqueName = "Date"
            FileExplorer1.Grid.Columns.Add(gtc); 
            FileExplorer1.Grid.Columns[0].HeaderStyle.Width = 450; 
            FileExplorer1.Grid.Columns[1].HeaderStyle.Width = 200; 
            FileExplorer1.Grid.Columns[1].ItemStyle.HorizontalAlign = HorizontalAlign.Right; 
            FileExplorer1.Grid.Columns[1].HeaderStyle.HorizontalAlign = HorizontalAlign.Right; 
            FileExplorer1.Grid.Columns[2].ItemStyle.HorizontalAlign = HorizontalAlign.Right; 
            FileExplorer1.Grid.Columns[2].HeaderStyle.HorizontalAlign = HorizontalAlign.Right; 
            FileExplorer1.WindowManager.Behavior = WindowBehaviors.Maximize | WindowBehaviors.Minimize | WindowBehaviors.Close | WindowBehaviors.Move | WindowBehaviors.Resize; 
        } 
    } 
    private static int DateComparer(FileBrowserItem item1, FileBrowserItem item2) 
    { 
        //treat folders separate from files 
        DateTime date1 = DateTime.Parse(item1.Attributes["Date"]); 
        DateTime date2 = DateTime.Parse(item2.Attributes["Date"]); 
        if (item1 is DirectoryItem) 
        { 
            if (item2 is DirectoryItem) 
            { 
                return DateTime.Compare(date1, date2); 
            } 
            else 
            { 
                return -1; 
            } 
        } 
        else 
        { 
            if (item2 is DirectoryItem) 
            { 
                return 1; 
            } 
            else 
            { 
                return DateTime.Compare(date1, date2); 
            } 
        } 
    } 
 
    public class CustomColumnsContentProvider : FileSystemContentProvider 
    { 
        public CustomColumnsContentProvider(HttpContext context, string[] searchPatterns, string[] viewPaths, string[] uploadPaths, string[] deletePaths, string selectedUrl, string selectedItemTag) 
            : base(context, searchPatterns, viewPaths, uploadPaths, deletePaths, selectedUrl, selectedItemTag) 
        { 
            // Declaring a constructor is required when creating a custom content provider class 
        } 
 
        public override DirectoryItem ResolveDirectory(string path) 
        { 
            // Update all file items with the additional information (date, owner) 
            DirectoryItem oldItem = base.ResolveDirectory(path); 
 
            foreach (FileItem fileItem in oldItem.Files) 
            { 
                // Get the information from the physical file 
                FileInfo fInfo = new FileInfo(Context.Server.MapPath(VirtualPathUtility.AppendTrailingSlash(oldItem.Path) + fileItem.Name)); 
 
                // Add the information to the attributes collection of the item. It will be automatically picked up by the FileExplorer 
                // If the name attribute matches the unique name of a grid column 
                fileItem.Attributes.Add("Date", fInfo.CreationTime.ToString("dd.MM.yyyy HH:mm")); 
            } 
 
            return oldItem; 
        } 
 
        public override DirectoryItem ResolveRootDirectoryAsTree(string path) 
        { 
            // Update all directory items with the additional information (date, owner) 
            DirectoryItem oldItem = base.ResolveRootDirectoryAsTree(path); 
 
            foreach (DirectoryItem dirItem in oldItem.Directories) 
            { 
                // Get the information from the physical directory 
                DirectoryInfo dInfo = new DirectoryInfo(Context.Server.MapPath(VirtualPathUtility.AppendTrailingSlash(dirItem.Path))); 
 
                // Add the information to the attributes collection of the item. It will be automatically picked up by the FileExplorer 
                // If the name attribute matches the unique name of a grid column 
 
                dirItem.Attributes.Add("Date", dInfo.LastWriteTime.ToString("dd.MM.yyyy HH:mm")); 
            } 
            return oldItem; 
        } 
    } 
 
 


Best regards,
Thomas






0
Petio Petkov
Telerik team
answered on 14 May 2010, 04:23 PM
Hello Tomaž Lovrec,

I tested the code you sent with FF3.5, IE8 and Google Chrome and everything seems to be fine.
Please try to create a page with RadFileExplorer(only) and check whether the problem exists.
In case that the problem exists, please open a new support thread and send us a running project or live URL, where we can observe the problem locally. Once we receive it we will do our best to help you.

Regards,
Petio Petkov
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.
0
Tomaž Lovrec
Top achievements
Rank 1
answered on 17 May 2010, 07:40 AM
Hello Petio,

Thank you very much for your time and help. I will try to resolve the issue and post back the results.

Best regards,
Thomas
Tags
FileExplorer
Asked by
Tomaž Lovrec
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Tomaž Lovrec
Top achievements
Rank 1
Share this question
or