且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在单击提交按钮后禁用页面并处理该按钮的继续

更新时间:2022-12-17 19:57:57

老兄,
我认为您的问题与禁用ASP.NET按钮非常相似使用AJAX加载背景图片进行回发期间的控制 [ ^ ].

您需要添加一个函数,该函数将根据传入的参数来禁用和启用所有(所需的)控件.现在,在按钮onclick javascript event中的函数中调用该函数.按钮aspx代码将如下所示:
Hi Mits,
I think your question is very similar to Disabling an ASP.NET Button Control During Postback with an AJAX Loading Background Image[^].

You need to add a function which will disable and enable all the controls(which you need) based on the parameter passed in it. Now call the function in the function in button onclick javascript event. Button aspx code will be like this:
<asp:button id="btn" runat="server" onclientclick="fnDisable('true')" onclick="btn_Click" xmlns:asp="#unknown" />


完成所有操作后,从页面源调用同一事件.试试这个:


After doing all the stuffs call the same event from page source. Try this:

protected void btn_Click(object sender, EventArgs e){
     //Do your all process.
     ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Enable", "fnDisable('false');", true);
}




希望对您有帮助!
  -授予




Hope it helps!
  --Amit


单击按钮时,触发JavaScript代码(将在服务器单击代码之前执行).在此JS代码中,根据需要在整个页面或指定区域上放置一个div(Z索引较高).稍后,服务器进程完成后,您可以再次隐藏div.

只要执行按钮单击过程,整个过程都会使页面感觉被禁用.
On button click, trigger a JavaScript code (which will be executed before server click code). In this JS code, place a div (with a higher z-index) over the whole page or specified area as per need. Later, once the server process is complete, you can hide div again.

This whole process would give a feel of disabled page as long the button click process was executing.