简体   繁体   English

更新面板必须缺少一些东西,但无法弄清楚是什么

[英]Update Panel must be missing something but cannot figure out what

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
    <asp:UpdatePanel runat="server" ID="UpdatePanel1"
        OnLoad="UpdatePanel1_Load">
        <ContentTemplate>
            <asp:Label runat="server" ID="Label1" />
        </ContentTemplate>
    </asp:UpdatePanel>
</div>
</asp:Content>

CodeBehind 代码隐藏

public partial class _Default : Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void UpdatePanel1_Load(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToString();
        UpdatePanel1.Update();

    }

}

I am missing something here I have done 100 times but this one time it seems to refuse to work. 我在这里错过了一些我做了100次,但有一次它似乎拒绝工作。 I just need an extra set of eyes to see what I am not. 我只需要一双额外的眼睛来看看我不是。 I am just telling an update panel to update when the div is clicked the problem is it always does a full page postback. 我只是告诉更新面板更新何时单击div,问题是它总是进行整页回发。

I tried the two suggestions below and no luck the thing that has me starching my head is that I tried it in a brand new project as well and no luck at all. 我尝试了下面的两个建议,没有运气让我头疼的事情是我在一个全新的项目中尝试过它而且没有运气。

I believe you are causing a recursion when you call Update() because it will fall again in the Load event. 我相信你在调用Update()时会导致递归,因为它会在Load事件中再次出现。 Just remove the Update() and it should work. 只需删除Update()即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何找出起订量中缺少的内容? - How to figure out what is missing in Moq? 无法弄清楚如何在C#中的查询表达式错误中修复语法错误(缺少运算符) - Cannot figure out how to fix syntax error (missing operator) in query expression error in C# 无法找出客户端错误 - Cannot figure out Client Error 无法弄清楚如何从单独的.xaml窗口更新文本框控件 - Cannot figure out how to update a textbox control from a separate .xaml window 请帮助从 C# 的文本框中找出这个数据库更新语句有什么问题 - Please help figure out what's wrong with this database update statement from text boxes in C# 我继承了一个较旧的Web窗体站点代码,无法弄清楚它出了什么问题 - I've inherited an older web forms site code and cannot figure out what is wrong with it 遵循有关Web服务的教程之后,遇到了麻烦,无法弄清楚该怎么做 - Following a tutorial for web services, hit a wall, cannot figure out what to do 此SqlTransaction已完成; 它不再可用。 -无法找出问题所在 - This SqlTransaction has completed; it is no longer usable. - Cannot figure out what is wrong 我无法弄清楚这个基本的NHibernate查询在做什么错 - I cannot figure out what I'm doing wrong with this basic NHibernate query 无法弄清楚此jQuery代码的工作方式 - Cannot figure out how this jQuery code is working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM