2016-04-21 38 views
0

我有一个 UpdatePanel以及一些其他控件。其他控件按预期执行部分回发,但ColorPickerExtender执行完整回发,尽管处于UpdatePanel。下面是相关的ASPX:obout:UpdatePanel中的ColorPickerExtender导致完全回传

<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> 

当我制定的问题,我能找出答案(见下文) - 而不是捣毁的问题,我离开这里供他人使用。

回答

0

事实证明,ColorPickerExtender未被注册为异步回发控件。我从this post得到线索。我不确定为什么它没有注册为异步控制时,其他人这样做,但修复很容易 - 添加一个<Triggers>部分明确指定它为异步,如下所示:

<Triggers> 
    <asp:AsyncPostBackTrigger ControlID="cpeLayoutBackgroundColor" EventName="ColorPostBack" /> 
</Triggers> 
相关问题