ASP.NET C# Ajax: Problem getting UpdatePanel refresh

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pechar
    New Member
    • Jan 2008
    • 56

    ASP.NET C# Ajax: Problem getting UpdatePanel refresh

    Hi All,

    This question has been asked many times and I've checked most of the sites with resolutions. None worked for me.
    1) I have a page which is a content page to a Masterpage .
    2) I have a ScriptManager on the Masterpage.
    3) On the content page I have a TabContainer control.
    4) On one of the tabs I have a form, part of which (a FileUpload control) I set to disabled if a Checkbox is ticked.

    So I decided to put an UpdatePanel around this FileUpload control and set a trigger for the Checkbox (which has Autopostback="t rue"). When stepping through the project the OnCheckChanged where the FileUpload is enabled/disabled is called but the UpdatePanel is not updating i.e. The FileUpload remains disabled.

    Below is my code:
    Code:
    <asp:UpdatePanel ID="upnlAgentLogo" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
          <tr>                                      
              <td >
                  <asp:CheckBox ID="chkAgent" runat="server" 
                  AutoPostBack="True" OnCheckedChanged="chkAgent_CheckedChanged" />
              </td>
          </tr>
          <tr>                                        
              <td >
                  <asp:FileUpload ID="fuAgentLogo" runat="server" />
              </td>
          </tr>                                    
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="chkAgent" />
        </Triggers>
    </asp:UpdatePanel>
    I tried many different things like putting the checkbox out of the updatepanel but still nothing. Any idea what is going on?

    Thanks
    Luk
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by pechar
    ... When stepping through the project the OnCheckChanged where the FileUpload is enabled/disabled is called but the UpdatePanel is not updating i.e. The FileUpload remains disabled.

    I tried many different things like putting the checkbox out of the updatepanel but still nothing. Any idea what is going on?

    Thanks
    Luk
    When you autopostback with the CheckBox, are you attempting to upload the file in the FileUpload control?

    At this time (as far as I'm aware) the UpdatePanel does not support the FileUpload control. If the FileUpload control is within an UpdatePanel the file will never get to the server. The FileUpload may be enabled, but because its in the UpdatePanel the file cannot get to the server.

    FileUpload controls require full page postbacks.

    -Frinny

    Comment

    • pechar
      New Member
      • Jan 2008
      • 56

      #3
      Originally posted by Frinavale
      When you autopostback with the CheckBox, are you attempting to upload the file in the FileUpload control?

      At this time (as far as I'm aware) the UpdatePanel does not support the FileUpload control. If the FileUpload control is within an UpdatePanel the file will never get to the server. The FileUpload may be enabled, but because its in the UpdatePanel the file cannot get to the server.

      FileUpload controls require full page postbacks.

      -Frinny
      Hi Frinny,

      Thanks for your reply. I'm not trying to upload the file only enable the FileUpload control thats all. Otherwise for uploading I dont mind having a full postback. Any idea what I could be doing wrong?

      Thanks
      Luk

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by pechar
        Hi Frinny,

        Thanks for your reply. I'm not trying to upload the file only enable the FileUpload control thats all. Otherwise for uploading I dont mind having a full postback. Any idea what I could be doing wrong?

        Thanks
        Luk
        I would recommend using JavaScript to enable the FileUpload control when the checkbox has been checked.Somethi ng like the solution I recommended in this thread.

        -Frinny

        Comment

        • pechar
          New Member
          • Jan 2008
          • 56

          #5
          Originally posted by Frinavale
          I would recommend using JavaScript to enable the FileUpload control when the checkbox has been checked.Somethi ng like the solution I recommended in this thread.

          -Frinny
          Thanks Frinny,

          Will have a look at it.

          Luk

          Comment

          Working...