asp.netupdatepanelobout

obout:ColorPickerExtender in UpdatePanel causes full postback


I have an obout ColorPickerExtender in an UpdatePanel along with some other controls. The other controls execute partial postbacks as expected, but the ColorPickerExtender executes a full postback despite being in the UpdatePanel. Here's the relevant ASPX:

<asp:Content ContentPlaceHolderID="cphMainDivContentPlaceHolder" runat="server">
    <asp:UpdatePanel ID="upGeneralLayoutData" runat="server">
        <ContentTemplate>
            <asp:TextBox ID="txtLayoutName" runat="server" 
                ToolTip="Enter a name for this layout (recommend you use a unique name)" 
                OnTextChanged="txtLayoutName_TextChanged" 
                AutoPostBack="true" 
                MaxLength="255" />
            <obout:ColorPickerExtender ID="cpeLayoutBackgroundColor" runat="server" 
                OnClientOpen="onColorPickerExtenderOpen" 
                AutoPostBack="true" 
                TargetProperty="style.backgroundColor" 
                OnColorPostBack="cpeLayoutBackgroundColor_ColorPostBack" 
                PopupButtonID="txtLayoutBackgroundColor" 
                TargetControlID="txtLayoutBackgroundColor" 
                HexView="False" 
                PickButton="False" />
            <asp:TextBox ID="txtLayoutBackgroundColor" runat="server" 
                ToolTip="Select the background color for this layout" 
                CssClass="ColorPickerExtenderTextBox" 
                style="cursor: pointer" 
                Width="50" 
                ReadOnly="True" />
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

As I was formulating the question, I was able to figure out the answer (see below)--instead of trashing the question, I left it here for others to use.


Solution

  • It turns out that the ColorPickerExtender is not being registered as an async postback control. I got the clue from this post. I'm not sure why it doesn't register as an async control when the others do, but the fix is easy enough--add a <Triggers> section that explicitly designates it as async, like so:

    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="cpeLayoutBackgroundColor" EventName="ColorPostBack" />
    </Triggers>