C# ASP UpdatePanel没有';行不通

C# ASP UpdatePanel没有';行不通,c#,asp.net,C#,Asp.net,我尝试使用UpdatePanel更新我的aspx页面的一部分,但它不起作用 以下是aspx页面代码的一部分: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate&g

我尝试使用UpdatePanel更新我的aspx页面的一部分,但它不起作用

以下是aspx页面代码的一部分:

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>                                
           <asp:CheckBox ID="cb1" name="cb1" runat="server" OnCheckedChanged="cb_test_CheckedChanged" AutoPostBack="true" /><label for="cb1"><%=DateTime.Now %></label>
    </ContentTemplate>
</asp:UpdatePanel>
当我尝试点击复选框时,不会想到文本框

注意:在浏览器控制台中,我有:

Error: Sys. WebForms. PageRequestManagerParserErrorException: impossible to analyze the message received from the waiter(server). This error can have several possible causes: answer modified by calls(appeals) to Response. Write (), leak out of answer, HttpModules or activation of track of the waiter(server). Details: error of analysis near '

如果您将复选框置于更新面板之外,它将起作用,同时删除UpdatePanel1.update();暗中

<asp:CheckBox ID="cb1" name="cb1" runat="server" OnCheckedChanged="cb_test_CheckedChanged" AutoPostBack="true" /><label for="cb1">Example</label>
<asp:UpdatePanel runat="server" ID="UpdatePanel1">
    <ContentTemplate>            
        <asp:TextBox runat="server" ID="bidon" />
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger  ControlID="cb1" />
    </Triggers>
</asp:UpdatePanel>


        protected void cb_test_CheckedChanged(object sender, EventArgs e)
    {
        bidon.Text = DateTime.Now.ToString();
    }
示例
受保护的无效cb_测试_CheckedChanged(对象发送方,事件参数e)
{
bidon.Text=DateTime.Now.ToString();
}

尝试在UpdatePanelIs上设置ChildrenAsTriggers=“True”cb_test_CheckedChanged调用被命中?@DarrenGourley它成功了,但仍然没有成功working@Justin当我调试时,它到达cb_test_CheckedChanged方法,在cb_test_CheckedChanged上设置一个断点,并逐步完成请求的其余部分。确保它正常退出,并且不会遇到任何响应。Write()。另外,控制台中是否有关于javascript错误消息的更多信息?如果我在更新面板外选中复选框并删除UpdatePanel.1.update()我希望只刷新UpdatePanel。选中或取消选中复选框时,它将只刷新UpdatePanel,您尝试过了吗?这将执行一整页回发。您需要将asyncpostbacktrigger添加到UpdatePanel以使其正常工作。如果UpdatePanel不是条件UpdateMode,您也将无法使用UpdatePanel1.Update()。好的,我添加了一个AsyncPostBackTrigger,正如Darren所说,它将不再执行完整的postback@NorbertoEscobar我确实喜欢你写的东西,但我仍然没有工作,当我显示浏览器控制台时,我出现了上面的错误(编辑的帖子)
<asp:CheckBox ID="cb1" name="cb1" runat="server" OnCheckedChanged="cb_test_CheckedChanged" AutoPostBack="true" /><label for="cb1">Example</label>
<asp:UpdatePanel runat="server" ID="UpdatePanel1">
    <ContentTemplate>            
        <asp:TextBox runat="server" ID="bidon" />
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger  ControlID="cb1" />
    </Triggers>
</asp:UpdatePanel>


        protected void cb_test_CheckedChanged(object sender, EventArgs e)
    {
        bidon.Text = DateTime.Now.ToString();
    }