IZWebFileManager

Advanced ASP.NET File Manager
Welcome to IZWebFileManager Sign in | Join | Help
in Search
The forum is moved to http://groups.google.com/group/izwebfilemanager
If you have any question, please post there. Thanks!

Changing Root Directory with Dropdown

Last post 12-06-2010, 6:47 AM by larry.sanborn. 0 replies.
Sort Posts: Previous Next
  •  12-06-2010, 6:47 AM 622

    Changing Root Directory with Dropdown

    I'm trying to change the root directory of the filemanager dynamically based on the selected value from dropdown.

    The first pass allows me to select and creates a new filemanager correctly. If I choose a different value from the dropdown, I get a crash on recreating the control.

    From what I can debug withthe source, it's retaining the viewstate from the first creation and using it in the second rather than the newly instantiated control.

    I've tried this several different ways, recycling like this and just changing the root directory in code (page_load, iscallback) and result in the same error

    Any Thoughts?

    -- Larry

    The Code:

    Public Class uploads_default
        Inherits System.Web.UI.Page

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


            If Not IsPostBack Then
                selUser.DataSource = BuildSearch()
                selUser.DataTextField = "value"
                selUser.DataValueField = "key"
                selUser.DataBind()
            End If

        End Sub

        Private Sub selUser_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles selUser.SelectedIndexChanged

            phFileManager.Controls.Clear()

            ' create instance
            Dim fileManager As New FileManager()
            fileManager.Height = 500
            fileManager.Width = 740

            ' add root directory
            Dim rootdir As String = "~/files/" & selUser.SelectedValue
            Dim rootDirectory As New RootDirectory()
            rootDirectory.DirectoryPath = rootdir
            rootDirectory.Text = selUser.SelectedValue
            fileManager.RootDirectories.Clear()
            fileManager.RootDirectories.Add(rootDirectory)

            phFileManager.Controls.Add(fileManager)

        End Sub
    End Class

View as RSS news feed in XML
www.IZWebFileManager.com
izwebfilemanager@gmail.com