RadUpload1.UploadedFiles.Count = 0 with Window.Confirm

Thread is closed for posting
3 posts, 0 answers
  1. Sudhanva
    Sudhanva avatar
    27 posts
    Member since:
    Apr 2009

    Posted 21 Jul 2009 Link to this post




    I have a scenario, where i need to show a confirm msg box, for user. i.e.

    Please find the sample code for yout reference.


     <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
            <asp:Label ID="Label1" runat="server" ForeColor="Red" Visible="false"></asp:Label> 
            <telerik:RadUpload ID="RadUpload1" runat="server" ControlObjectsVisibility="None" 
                InputSize="34" Width="225px" ReadOnlyFileInputs="true" AllowedFileExtensions=".xls" 
                <Localization Select="Browse" /> 
            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="window.confirm('This will replace the current file. Do you want to continue?');" /> 
    protected void Button1_Click(object sender, EventArgs e)  
            Label1.Visible = true;  
            if (RadUpload1.UploadedFiles.Count > 0)  
                //Code to save the file  
                Label1.Text = "File uploaded successfully";  
                Label1.Text = "Select a file to upload";  

    With this the RadUpload1.UploadedFiles.Count is becoming zero. So i am unable to upload the file.

    I know that Upload control has some drawbacks in order to maintain security.

    Help me.

    Thanks & Regards,


  2. Shankar
    Shankar avatar
    1 posts
    Member since:
    Jun 2009

    Posted 21 Sep 2009 Link to this post

    Even i am facing same problem , file count is always  coming as zero.
    ia using follwoing code in cs file

       foreach (UploadedFile file in RadUpload1.UploadedFiles)
                file.SaveAs("C:\\VS2008 Projects\\TestUpload\\Files\\" + file.GetName(), true);

    RadUpload1.UploadedFiles  always comes as zero.

  3. DevCraft R3 2016 release webinar banner
  4. Qusay
    Qusay avatar
    3 posts
    Member since:
    Jan 2011

    Posted 13 Jun 2011 Link to this post

    Maybe the RadUpload1 is Ajaxified withing a RadAjaxPanel control or something. If this is your case then you should unajaxify the code that counts the files in the RadUpload1 control. For more information about unajaxifying controls (to cause themm to postback the code to the server), please refer to this link: http://www.telerik.com/help/aspnet-ajax/ajax-exclude.html. Hope this helps.


Back to Top