UpdatePanel not resizing for new content in Firefox

Last post 01-30-2008 12:09 AM by gavinharriss. 5 replies.

Sort Posts:

  • UpdatePanel not resizing for new content in Firefox

    01-20-2008, 9:17 PM

    Hi,

    Has anyone come across this issue and can provide me with any advice? ...

    I have an UpdatePanel which is displaying new html content, but it isn't resizing correctly in Firefox when the new content is rendered (IE works fine).

    To see the issue in action:

    1. Go to http://www.yougodo.com/Trade/Buttons.aspx
    2. Under the Country / Location heading do a Location Search, for example "Sydney".
    3. Note how the "Include activities within" input field has now been pushed down by the search results and is now hidden.

    I'm guessing it might be because the UpdatePanel is inside a Panel making use of the CollapsiblePanelExtender? Possibly the CollapsiblePanelExtender isn't updating it's height correctly?

    Any help would be greatly appreciated.

    Cheers,

    Gavin.
     

    Gavin Harriss
    Portfolio: www.gavinharriss.com
  • Re: UpdatePanel not resizing for new content in Firefox

    01-21-2008, 5:55 AM
    • Loading...
    • ravi.ambar
    • Joined on 09-08-2007, 9:22 PM
    • Posts 33

     hi gavin,


    if it is working with IE and not working for mozilla or other browsers then just try to implement browser capabilities.It will be display correctly in all browsers

    Try this in web.config under system.web

    <browserCaps>
      <!-- GECKO Based Browsers (Netscape 6+, Mozilla/Firebird, ...) //-->
      <case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+)? (?'type'[^/\d]*)([\d]*)/(?

    'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)).*">
        browser=Gecko
        type=${type}
        frames=true
        tables=true
        cookies=true
        javascript=true
        javaapplets=true
        ecmascriptversion=1.5
        w3cdomversion=1.0
        css1=true
        css2=true
        xml=true
        tagwriter=System.Web.UI.HtmlTextWriter      <-- you can set this to
    System.Web.UI.Html32TextWriter  also as per your design -->
        <case match="rv:(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
          version=${version}
          majorversion=${major}
          minorversion=${minor}
          <case match="^b" with="${letters}">
            beta=true
          </case>
        </case>
      </case>
     
      <!-- AppleWebKit Based Browsers (Safari...) //-->
      <case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))">
        browser=AppleWebKit
        version=${version}
        majorversion=${major}
        minorversion=0.${minor}
        frames=true
        tables=true
        cookies=true
        javascript=true
        javaapplets=true
        ecmascriptversion=1.5
        w3cdomversion=1.0
        css1=true
        css2=true
        xml=true
        tagwriter=System.Web.UI.HtmlTextWriter
        <case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))( \(KHTML, like Gecko\) )?(?'type'[^/\d]*)/.*$">
          type=${type}
        </case>
      </case>
      <!-- Konqueror //-->
      <case match = "Konqueror/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'));\w*(?'platform'[^\)]*)">
        browser=Konqueror
        version=${version}
        majorversion=${major}
        minorversion=${minor}
        platform=${platform}
        type=Konqueror
        frames=true
        tables=true
        cookies=true
        javascript=true
        javaapplets=true
        ecmascriptversion=1.5
        w3cdomversion=1.0
        css1=true
        css2=true
        xml=true
        tagwriter=System.Web.UI.HtmlTextWriter
      </case>
    </browserCaps>  
     
     For more information read this artical
     


     

  • Re: UpdatePanel not resizing for new content in Firefox

    01-21-2008, 6:15 AM

    Thanks for the input, but I'm pretty sure this isn't a solution to my issue as rendering in Firefox is fine. It's just new content delivered by AJAX isn't automatically getting enough room to display the complete content.

    Have a look at the page in IE and follow the instuctions to re-create issue in original post (no problem). Then repeat in Firefox and you'll soon see the issue.

    I'm guessing the possible solution might be some JavaScrip hack executed after AJAX has updated the UpdatePanel?

    Cheers,

    Gavin. 

    Gavin Harriss
    Portfolio: www.gavinharriss.com
  • Re: UpdatePanel not resizing for new content in Firefox

    01-25-2008, 3:57 AM
    Answer

    Hi,

    You are right,the CollapsiblePanel doesn't update its height.

    You can set ScrollContents to true to scroll the content or you can change the height of it using javascript when the request is returned.

    ScrollContents - True to add a scrollbar if the contents are larger than the panel itself. False to just clip the contents.

    Best Regards,

    Sincerely,
    Jin-Yu Yin
    Microsoft Online Community Support
  • Re: UpdatePanel not resizing for new content in Firefox

    01-25-2008, 6:02 PM

    Hi Jin-Yu Yin,

    Thanks for the help. Interesting thing is that it does seem to resize without problem and prompting in IE though. It's just Firefox that the issue presents itself.

    I'm going to try and stay clear of using scrollbars for now, and when I get 5 mins I'll investigate if the CollapsiblePanel has some client-side functionality I can call to re-calculate it's height based on it's new content. Don't suppose you know of any JavaScript I can call for this on an AJAX postback?

    Cheers, 

    Gavin. 

    Gavin Harriss
    Portfolio: www.gavinharriss.com
  • Re: UpdatePanel not resizing for new content in Firefox

    01-30-2008, 12:09 AM
    Answer

    For anyone else that stumbles upon this thread with a similar problem... The following fudge seems to get around my problem on Firefox:

    The following client-side script is added

    function CollapsiblePanelExtender_OpenOrClose(behaviorId,open)
    {
        // NOTE: JavaScript error is caused by AJAX Control Toolkit, so error is captured and discarded to allow code to function in FireFox.
        //       http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=9612
        behavior = $find(behaviorId);
        if (open)
            try {behavior._doOpen();} catch(e) {}
        else
            try {behavior._doClose();} catch(e) {}
    }
    and server side, any time AJAX postbacks cause an update to the content then I call
    Me.script.RegisterStartupScript(Me.Page, Me.GetType(), "ExpandLocs", "CollapsiblePanelExtender_OpenOrClose('bhvrLoc',true);", True)
    'bhvrLoc' is the BehaviorID I've assigned to my CollapsiblePanelExtender.
    If anyone comes up with a more elegant solution I'd love to hear it. Cheers ;) 
    Gavin Harriss
    Portfolio: www.gavinharriss.com
Page 1 of 1 (6 items)
Microsoft Communities
Page view counter