UploadedFiles.Count returns 0

2 posts, 1 answers
  1. Kevin
    Kevin avatar
    1 posts
    Member since:
    Aug 2010

    Posted 11 Aug 2010 Link to this post

    Hello,
    I'm using a RadUpload control.
    I have a Panel control that includes RadUpload and it's Submit button (WebControls.Button).
    Depends on some conditions I'm playing with visibility of the Panel.
    When the panel is visible, I can choose file to upload, then when I press Submit button - UploadedFiles.Count shows 0 files.
    I'm using
    RadAjaxManager to make my page load different parts of my page smoothly and of cause, I use it for the Panel (described above).

    It works fine if I take the Submit button out from the panel and make it always visible, but unfortunately that‘s not the case.

    When I’m using RadAjaxManager to “load” the Submit button, it stops read data from RadUpload control.

    Can you please help me out and let me know what is the work around this problem???

     

    Thanks,

    Kevin

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

    Posted 11 Aug 2010 Link to this post

    Hello Kevin,

    The reason it shows no UploadedFiles is because the button is performing an ajax request. To disable ajax when the button is pressed, you'll need to do something like this:

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
       function RequestStart(sender, eventArgs) {
           var eventTarget = eventArgs.get_eventTarget();
           if (eventTarget.indexOf("Button1")!= -1) {
               eventArgs.set_enableAjax(false);
           }
       }
    </script>
    </telerik:RadCodeBlock>

    Where I wrote "Button1" you should add the name of your button and then attach this event to you RadAjaxManager's OnRequestStart client event.

    I hope that helps.
Back to Top