Update Panel and CSS

Last post 09-20-2009 12:31 PM by Matan Nativ. 4 replies.

Sort Posts:

  • Update Panel and CSS

    03-30-2009, 8:37 PM

    I have an update panel in a user control which is contained in a parent page.  The update panel has async triggers which refer to buttons outside of the update panel. The update panel containts a literal control that has the .Text value set via code depending on which button is clicked. NOTE: The literal is used for displaying the results of a transform XML=>HTML.  The buttons, when clicked, cause an async postback and the appropriate code executes. The problem is that initially the css styling for the update panel works (the literal control has default content) but when the buttons(triggers) are clicked the styling is messed up (absolute positioning does not work).  Also, the buttons disappear completely.

    What is strange is that if I "wrap" the literal control in <fieldset><legend> tags, everything works correctly.  Any ideas on why this happens or suggestions ?

    <html>
    <head id="Head1" runat="server">
        <style type="text/css">
        #UpdatePanel1 {
          height: 600px;
    width: 400px;
    border: 1px solid #666666;
    padding: 8px; 
    position:  absolute;
    overflow: auto;
    white-space:  nowrap;
         }
        </style>

    </head>
    <body>
        <form id="form1" runat="server">

    <div>
    <asp:Button ID="Button1" runat="server" Text="Next" OnClick="Button1_Click" />
    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Prev" /></div>

      <asp:ScriptManager ID="ScriptManager1" runat="server"  EnablePartialRendering="true">
            </asp:ScriptManager>

     <asp:UpdatePanel ID="UpdatePanel1" runat="server"  UpdateMode="Conditional">
            <Triggers>
     <asp:AsyncPostBackTrigger ControlID="Button1" />
     <asp:AsyncPostBackTrigger ControlID="Button2" />
     </Triggers>
                <ContentTemplate>
      <asp:Literal  runat="server" ID="Literal1"></asp:Literal>

                </ContentTemplate>
            </asp:UpdatePanel>

        </form>
    </body>
    </html>

     

     

     

     

  • Re: Update Panel and CSS

    03-30-2009, 11:24 PM
  • Re: Update Panel and CSS

    03-31-2009, 8:55 AM
    • Star
      8,978 point Star
    • dwhite
    • Member since 02-08-2007, 2:25 PM
    • Bristol, CT
    • Posts 1,422

    Don't put the positioning styles on the UpdatePanel.  Try wrapping the control in a DIV and apply the styles to that, see an example below.  One other thing, I don't think you need absolute positioning based on the styles you posted, you should just be able to exclude it.  

    For example:
    <div id="myContainer">
    ... UpdatePanel Code ...
    </div>

        <style type="text/css">
        #myContainer {
          height: 600px;
          width: 400px;
          border: 1px solid #666666;
          padding: 8px; 
          position:  absolute;
          overflow: auto;
          white-space:  nowrap;
         }
        </style>

    -Damien

    Visoft, Inc - Home | Blogs

    Latest Blog Post: Silverlight DataBinding Bug
  • Re: Update Panel and CSS

    03-31-2009, 11:57 AM

    Thanks for the blog posts referring to the IE bug but I've already seen those. I've also tried moving the <DIV> tags around the control not the update panel and same results.

     I'm more curious why <FIELDSET> and <LEGEND> tags around the literal control solves the problem. No other container HTML container tags seem to work. Does anyone know what happens with the  <FIELDSET> and <LEGEND> tags that would explain this or is there something about them that  effects absolute positioning different from other tags?

  • Re: Update Panel and CSS

    09-20-2009, 12:31 PM
    • Member
      2 point Member
    • Matan Nativ
    • Member since 09-20-2009, 12:28 PM
    • Posts 1

    hello,

    i encounterd the exact same problem as joanthan. did anyone find a proper soution to this prob other than using the <fieldset> tag?

    thanx.

Page 1 of 1 (5 items)