Panel not working

5 posts, 0 answers
  1. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 02 Nov 2010 Link to this post

    I'm sure this is simple but I'm missing something and I can't figure out what. I'm just trying to get my function to respond when I click on a button within a ajax panel. Here is my aspx.
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="admin_Default" %>
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            </telerik:RadScriptManager>
             
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" HorizontalAlign="NotSet">
                 
                Please select a file:
                <asp:FileUpload ID="FileUpload1" runat="server" /><br />
                 
                <asp:Button ID="upload" Text="Upload" runat="server" /><br />
                <asp:Label ID="output" runat="server"></asp:Label>
                 
        </telerik:RadAjaxPanel>
     
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Transparency="10" BackgroundPosition="Center">
            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.LoadingProgressBar.gif") %>'
                style="border: 0px;" />
            </telerik:RadAjaxLoadingPanel>
        </div>
        </form>
    </body>
    </html>


    And here is my vb. What am I missing
    Partial Class admin_Default
        Inherits System.Web.UI.Page
     
        Protected Sub upload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles upload.Click
            Response.Write("test")
     
            If (FileUpload1.HasFile) Then
     
                Try
                    Dim name As String = FileUpload1.FileName.ToString
                    Dim ext As String = System.IO.Path.GetExtension(FileUpload1.FileName)
     
                    If (ext = ".csv") Then
     
                        FileUpload1.SaveAs(Server.MapPath("~/admin/temp/" & name))
     
                    Else
     
                        output.Text = "<span style='color: red;'>Invalid file type. File must be CSV.</span>"
     
                    End If 'if ext = .csv
     
     
                Catch ex As Exception
                    Response.Write(ex.ToString)
                End Try 'fileupload.hasfile
     
            Else
     
                output.Text = ("<span style='color: red;'>Please make sure you have selected a file and the size is greater than 0 bytes.</span>")
     
            End If 'fileupload.hasfile
     
        End Sub
    End Class

  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 03 Nov 2010 Link to this post

    You can ajaxify a file upload. If you want to upload a file, you need to cancel the ajax request when the upload button is pressed. Like in this help article:

    http://www.telerik.com/help/aspnet-ajax/ajxajaxandupload.html

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 03 Nov 2010 Link to this post

    Hi guys,

    An alternative solution would be to use RadAsyncUpload to upload files asynchronously. Consider it as another option to get what you want.

    Best,
    Sebastian
    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
  5. Web Services
    Web Services avatar
    243 posts
    Member since:
    Apr 2008

    Posted 03 Nov 2010 Link to this post

    Forgive my ignorance, but what is the benefit of using the async upload over just a normal file uploader?
  6. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 03 Nov 2010 Link to this post

    Hello Web Services,

    The major advantage is that you will upload files asynchronously instead of using plain postbacks. Examine the online demos to see that in action.

    Best regards,
    Sebastian
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017