IZWebFileManager

Advanced ASP.NET File Manager
Welcome to IZWebFileManager Sign in | Join | Help
in Search

IZWebFileManager in an ASCX?

Last post 05-31-2009, 5:23 AM by Ychuang. 1 replies.
Sort Posts: Previous Next
  •  05-31-2009, 5:18 AM 396

    IZWebFileManager in an ASCX?

    Hi,
    I'm very impressed in this component. I wrote an ASCX to include IZWebFileManager and add a new FileManagerCommand called SelectedFile.(Use ExecuteCommand to handle event. Thanks to your genius architecture design!). However, when I tried to use this ASCX and set a TextBox in ASPX file to retrieve the SelectFile, the value can be seen in debug mode, but the TextBox in the page doesn't show a correct value. Do u have any idea why?

    Thanks!
  •  05-31-2009, 5:23 AM 397 in reply to 396

    Re: IZWebFileManager in an ASCX?

    The ASCX file:

        public event EventHandler SelectFile;
        private string _SelectedFile;
        public string SelectedFile
        {
            get
            {
                return _SelectedFile;
            }
        }
        protected void OnSelectFile(EventArgs e)
        {
            if (SelectFile != null)
            {
                SelectFile(this, e);
            }
        }
        protected void FileManager1_ExecuteCommand(object sender, ExecuteCommandEventArgs e)
        {
            e.ClientScript = "alert('Use ExecuteCommand event to handle your custom command.\\nCommandName=" + e.CommandName + "\\nItem=" + e.Items[0].AbsolutePath + "')";
            if (e.CommandName == "SelectFile")
            {
                _SelectedFile = e.Items[0].AbsolutePath.ToString().Replace("/Root/", "");
                OnSelectFile(e);
            }
        }
    

    ASPX file:
        Protected Sub WebFileBrowser1_SelectFile(ByVal sender As Object, ByVal e As IZ.WebFileManager.ExecuteCommandEventArgs) Handles WebFileBrowser1.SelectFile
            Dim SelectedFile As String = e.Items(0).AbsolutePath.ToString().Replace("/Root/", "")
            Label1.Text = WebFileBrowser1.SelectedFile
        End Sub
    

    Both .SelectedFile and e.Items(0).AbsolutePath.ToString().Replace("/Root/", "") showed correct value, but in the ASPX page on client side doesn't show correctly... :'(
View as RSS news feed in XML
www.IZWebFileManager.com
izwebfilemanager@gmail.com