RadFileExplorer.Upload Null after PostBack

4 posts, 1 answers
  1. James
    James avatar
    16 posts
    Member since:
    Dec 2011

    Posted 08 Sep Link to this post

    We just upgraded our web server from Windows Server 2003 R2 with IIS 6.?  to Windows Server 2012 R2 with IIS 8.5.9600.

    We also upgraded the Telerik controls from 2010.3.1317.35 to 2016.2.607.35.

    A very simplified page example is:

    <body>
        <form id="form1" runat="server">
        <asp:HiddenField ID="hfToolId" runat="server" />
        <asp:HiddenField ID="hfTempDirectory" runat="server" />
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true">
        </telerik:RadScriptManager>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <div>
            <telerik:RadFileExplorer ID="rfeDocs" runat="server" OnClientFileOpen="OnClientFileOpen"
                DisplayUpFolderItem="false" EnableCreateNewFolder="false" Width="100%">
                <Configuration SearchPatterns="*.*" MaxUploadFileSize="104857600" />
            </telerik:RadFileExplorer>
        </div>
        </form>
    </body>

     

    Its associated code behind is:

    01.Partial Class _Default
    02.    Inherits System.Web.UI.Page
    03. 
    04.    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    05.        SetupFileExplorer()
    06.    End Sub
    07. 
    08.    Private Sub SetupFileExplorer()
    09.        Dim controls As Telerik.Web.UI.FileExplorer.FileExplorerControls = 0
    10.        Dim di As IO.DirectoryInfo
    11.        Dim newTempDirectory As String = String.Empty
    12.        Dim path(0) As String
    13.        Dim s = CType(rfeDocs.FindControl("splitter"), RadSplitter)
    14.        Dim toolId As Integer
    15. 
    16.        If IsNumeric(hfToolId.Value) Then
    17.            toolId = CInt(hfToolId.Value)
    18.        ElseIf Request.QueryString("equipmentid") IsNot Nothing Then
    19.            toolId = CInt(Request.QueryString("equipmentid"))
    20.        Else
    21.            toolId = 0
    22.        End If
    23. 
    24.        For Each item As RadToolBarItem In rfeDocs.ToolBar.Items
    25.            If TypeOf item Is RadToolBarButton Then
    26.                CType(item, RadToolBarButton).CausesValidation = False
    27.            End If
    28.        Next
    29. 
    30.        If toolId > 0 Then
    31.            path(0) = Page.ResolveUrl("~/Tools/" & toolId.ToString())
    32.        ElseIf Not String.IsNullOrEmpty(hfTempDirectory.Value) Then
    33.            path(0) = Page.ResolveUrl("~/Tools/" & hfTempDirectory.Value)
    34.        Else
    35.            newTempDirectory = Request.LogonUserIdentity.Name().Split(New Char() {"\"c})(1) & Now.Ticks
    36.            hfTempDirectory.Value = newTempDirectory
    37.            path(0) = Page.ResolveUrl("~/Tools/" & newTempDirectory)
    38.        End If
    39. 
    40. 
    41.        di = New IO.DirectoryInfo(Server.MapPath(path(0)))
    42. 
    43.        If Not di.Exists Then
    44.            di.Create()
    45.        End If
    46. 
    47.        rfeDocs.Configuration.ViewPaths = path
    48.        rfeDocs.Configuration.UploadPaths = path
    49.        rfeDocs.Configuration.DeletePaths = path
    50. 
    51.        rfeDocs.Upload.InitialFileInputsCount = 1
    52.        rfeDocs.InitialPath = path(0)
    53.        rfeDocs.Upload.EnableFileInputSkinning = False
    54.        rfeDocs.Grid.MasterTableView.TableLayout = GridTableLayout.Fixed
    55.        rfeDocs.Grid.ClientSettings.AllowRowsDragDrop = False
    56.        rfeDocs.Grid.ClientSettings.Resizing.ResizeGridOnColumnResize = True
    57.        rfeDocs.VisibleControls = FileExplorer.FileExplorerControls.Toolbar Or FileExplorer.FileExplorerControls.Grid
    58. 
    59.    End Sub
    60. 
    61.    Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
    62.        'just to force page postback
    63.    End Sub
    64.End Class

     

    The user would normally fill out a form, click a save button (which would cause the postback), then upload files via the RadFileExplorer control.  Prior to the server upgrades, the code worked fine, after the upgrades, the page fails on line 51 in the code behind.  The rfeDocs.Upload object/property is null/nothing.

    Is there anything incorrect with the page for the new version?

     

    Thank you,

    James

  2. Answer
    Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 10 Sep Link to this post

    Hi James,

    Several releases ago we made RadAsyncUpload default upload control in RadFileexplorer, as RadUpload is obsolete now. Nevertheless, you can still use it by applying the following configuration:
    <telerik:RadFileExplorer ID="rfeDocs" runat="server" OnClientFileOpen="OnClientFileOpen"
        DisplayUpFolderItem="false" EnableCreateNewFolder="false" Width="100%">
        <Configuration SearchPatterns="*.*" MaxUploadFileSize="104857600" EnableAsyncUpload="false" />
    </telerik:RadFileExplorer>

    Regards,
    Vessy
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. James
    James avatar
    16 posts
    Member since:
    Dec 2011

    Posted 12 Sep in reply to Vessy Link to this post

    That corrected my problem.  Thank you.
  5. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 12 Sep Link to this post

    Hi James,

    I am glad my answer was helpful for you. Let us know whenever we can be of any further assistance on the matter.

    Regards,
    Vessy
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top