File explorer is not refreshed ?

6 posts, 0 answers
  1. koteswararao
    koteswararao avatar
    39 posts
    Member since:
    Aug 2010

    Posted 16 Oct 2012 Link to this post

    hi experts ,

    i am using the file explorer control in my project , i have one dropdown with two folder names when user select the folder all the file explorer functionality will apply to that chosen folder here i find two panels one is for folder treeview other one is for files which shows the file name and size when i change the option in the folder dropdown first panel didn't show the selected folder but second panel shows the selected folder files can u tell me the reason  plz, please check the screen shots also,

    following is the code sinnpet which is written by be
    -====================-------
    <%@ Page Title="" Language="VB" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="false" CodeFile="FileExplorer.aspx.vb" Inherits="Admin_FileExplorer" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
      <div style="margin-left:50px" >
      <asp:DropDownList ID="ddlFiles" runat="server" AutoPostBack="true">
      <asp:ListItem >Images Folder</asp:ListItem>
      <asp:ListItem  Selected="True">Mass Image Uploading Folder</asp:ListItem>
      </asp:DropDownList>
     <br /><br />
        <telerik:RadFileExplorer runat="server" ID="fileExp" Width="520px" Height="520px">
                        <Configuration ViewPaths="~/HTMLEditorImages" UploadPaths="~/HTMLEditorImages" MaxUploadFileSize="26214400"
                        DeletePaths="~/HTMLEditorImages" />

                    </telerik:RadFileExplorer>
                    </div>
    </asp:Content>


    -===============================------
    Imports Telerik.Charting
    Imports Telerik.Web.UI
    Partial Class Admin_FileExplorer
        Inherits AdminPage

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            If ddlFiles.SelectedIndex <= 0 Then
                fileExp.Configuration.UploadPaths = {"~/HTMLEditorImages"}
                fileExp.Configuration.ViewPaths = {"~/HTMLEditorImages"}
                fileExp.Configuration.DeletePaths = {"~/HTMLEditorImages"}
            Else
                fileExp.Configuration.UploadPaths = {"~/Admin/FTPDirectory/MassImages"}
                fileExp.Configuration.ViewPaths = {"~/Admin/FTPDirectory/MassImages"}
                fileExp.Configuration.DeletePaths = {"~/Admin/FTPDirectory/MassImages"}
            End If

        End Sub

    End Class

     
  2. koteswararao
    koteswararao avatar
    39 posts
    Member since:
    Aug 2010

    Posted 17 Oct 2012 Link to this post

    can you tell me the way to achieve my  functionality plz,i struck for at this problem.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 17 Oct 2012 Link to this post

    Hi,

    I managed to reproduce the described issue and it has never entered in the "else" statement, because on Page_Load the ddlFiles.SelectedIndex was still equal to 0.

    We managed to workaround the problem, with the following approach:
     -  add a hidden field to the page and assigning it the DropDownList.selectedIndex value in the drop-down OnChange event handler
     - in the Page_Load event check if the hidden field's value is <= 0 (or NULL) and set the desired paths to the FileExplorer.
     - in order to reload the FileExplorer's TreeView with the new folders, we clear its nodes on every Page_Load call.

    ASPX:
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
     
    <div style="margin-left:50px">
    <asp:DropDownList ID="ddlFiles" runat="server" AutoPostBack="true" onchange="javascript:OnChange();">
        <asp:ListItem>Images Folder</asp:ListItem>
        <asp:ListItem>Mass Image Uploading Folder</asp:ListItem>
    </asp:DropDownList>
    </div>
     
    <telerik:RadFileExplorer ID="fileExp" runat="server"></telerik:RadFileExplorer>
     
    <asp:HiddenField ID="DDLSelectedIndex" runat="server" />
     
    <script type="text/javascript">
        function OnChange() {
            $get("DDLSelectedIndex").value = $get("ddlFiles").selectedIndex;
        }
    </script>
    </form>

    VB:
    Protected Sub Page_Load(sender As Object, e As EventArgs)
        fileExp.TreeView.Nodes.Clear()
     
        If [String].IsNullOrEmpty(DDLSelectedIndex.Value) OrElse Int32.Parse(DDLSelectedIndex.Value) <= 0 Then
            fileExp.Configuration.ViewPaths = New String() {"~/HTMLEditorImages"}
            fileExp.Configuration.DeletePaths = New String() {"~/HTMLEditorImages"}
            fileExp.Configuration.UploadPaths = New String() {"~/HTMLEditorImages"}
        Else
            fileExp.Configuration.ViewPaths = New String() {"~/Admin/FTPDirectory/MassImages"}
            fileExp.Configuration.DeletePaths = New String() {"~/Admin/FTPDirectory/MassImages"}
            fileExp.Configuration.UploadPaths = New String() {"~/Admin/FTPDirectory/MassImages"}
        End If
     
    End Sub


    Regards,
    Vesi
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. koteswararao
    koteswararao avatar
    39 posts
    Member since:
    Aug 2010

    Posted 19 Oct 2012 Link to this post

    thank you

    i resolved my problem by adding this line in the page load
    fileExp.TreeView.Nodes.Clear()

    Thanks & Regards,
    Koteswara Rao.
  6. koteswararao
    koteswararao avatar
    39 posts
    Member since:
    Aug 2010

    Posted 19 Oct 2012 Link to this post

    is there any possibility to show the units to that size columns like (kb,mb ...)

    let me know the feasibility of this 
  7. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 22 Oct 2012 Link to this post

    Hi,

    It could be done by attaching a handler to the OnRowDataBound() event of the Grid. More information and a demo project on the subject is available in the following code library:
    Customize the value shown in the Size column

    Regards,
    Vesi
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017