Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
283
WebAsyncRefreshPanel inside a WebGroupBox ?
posted

The following code works as expected:

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true">
           </asp:DropDownList> <igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server"
                Width="100%" RefreshTargetIDs="DropDownList2" TriggerControlIDs="DropDownList1" >
           <asp:DropDownList ID="DropDownList2" runat="server">
           </asp:DropDownList>
</igmisc:WebAsyncRefreshPanel>

If I wrap that in a  WebGroupBox it causes the whole page to postback:

<igmisc:WebGroupBox ID="WebGroupBox4" runat="server" Height="65px" Text="Test"
        Width="100%"  Font-Bold="true" >
    <Template>
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true">
     </asp:DropDownList> <igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server"
            Width="100%" RefreshTargetIDs="DropDownList2" TriggerControlIDs="DropDownList1" >
          <asp:DropDownList ID="DropDownList2" runat="server">
          </asp:DropDownList>
</igmisc:WebAsyncRefreshPanel>
   </Template>
   </igmisc:WebGroupBox>

 

Any ideas? 

Parents
  • 283
    posted

    It also seems to be broken if a TriggerControlIDs control is in the WebGroupBox. WebGrouBox renames the control to WebGroupBoxId_IdOfControl_ which apperanlty doesn't rename references to the old name outside of the control.

Reply
  • 12631
    posted in reply to Rudy

    What your seeing is the result of an interfaced called INamingContainer.  This is a marker interface that many .NET controls implement, especially controls that provide a template in which you can place arbitrary server controls.  The job of INamingContainer is to help ensure that ASP.NET gives each server control a unique ID when it renders the control.  This is important so that ASP.NET can construct a control tree on the server, which requires that every server control have a unique ID.

    Of course, having ASP.NET change ID's also presents some challanges (as you well know).  T  get around your problem, you can use the ClientID property that every ASP.NET control exposes.  This property gives you the resolved ID that ASP.NET actually renders in the page.  T ouse it, try changing your TriggerControlIDs property to:

    TriggerControlIDs="<%= IdOfControl.ClientID %>"  

    This should set the TriggerControlIDs to the resolved ClientID of your DropDownList.

    Devin

     

    BTW, ASP.NET's habit of changing the HTML element ID's is actually a common point of angst for ASP.NET developers.  Try googling "ASP.NET mangled ids"

Children
No Data