【问题标题】:UpdateProgress not showing when doPostBack is manually called from javascript从 javascript 手动调用 doPostBack 时,UpdateProgress 未显示
【发布时间】:2014-03-06 09:12:23
【问题描述】:

我正在使用更新面板和更新进度控件。在更新面板中,我有带有 TextChange 事件的文本框。当用户在文本框中输入 10 位数字时,会自动从 javascript 调用此事件。电话是:

__doPostBack("LabelTextBoxCode", "TextChanged");

这是我的 html 代码:

    <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdateProgress runat="server" ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel">
            <ProgressTemplate>
                ...processing
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
 <asp:TextBox ID="LabelTextBoxCode" runat="server" OnTextChanged="TextChanged_TextBoxCode">
                        </asp:TextBox>
    ...
  </ContentTemplate>
    </asp:UpdatePanel>

到目前为止,我发现的是这个线程 UpdateProgress Not working when called thru javascript,但它对我没有帮助(我不知道如何正确使用它)。

当我按下更新面板中的任何按钮时,会显示进度条,问题只是这个从 javascript 手动调用的 __doPostBack。

如何修复它并让 updateProgress 正常工作?

【问题讨论】:

标签: asp.net updatepanel dopostback updatepanel-progressbar


【解决方案1】:

直接调用 __doPostback 会绕过所有设置更新面板的触发器。因此,为避免这种情况,您可以调用OnBeginRequest 处理程序,也可以触发相同的按钮单击,而不是调用__dopostback。要触发按钮单击,您可以使用 jquery 触发功能。你可以得到一个例子here

希望这会有所帮助。

【讨论】:

  • 我使用按钮(显示:无)解决了它,然后我触发了这个按钮点击而不是调用 __doPostBack。这不是完美的解决方案,但我工作。谢谢
猜你喜欢
  • 2012-02-17
  • 2011-12-14
  • 1970-01-01
  • 2019-08-10
  • 1970-01-01
  • 2019-07-16
  • 2011-06-23
  • 2010-10-05
  • 2011-09-25
相关资源
最近更新 更多