Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在ASP.NETAjax中显示加载长时间运行进程的图像/进度条_C#_Asp.net_Ajax_Long Running Processes - Fatal编程技术网

C# 在ASP.NETAjax中显示加载长时间运行进程的图像/进度条

C# 在ASP.NETAjax中显示加载长时间运行进程的图像/进度条,c#,asp.net,ajax,long-running-processes,C#,Asp.net,Ajax,Long Running Processes,在ASP.NETAjax应用程序中执行长时间运行的进程时,如何为用户显示加载图像?除了使用页面方法,还有其他方法吗?有什么想法吗?在客户端,您可以连接Sys.WebForms.PageRequestManager BeginRequest: <script type="text/javascript" language="javascript"> Sys.WebForms.PageRequestManager.getInstance().add_beg

在ASP.NETAjax应用程序中执行长时间运行的进程时,如何为用户显示加载图像?除了使用页面方法,还有其他方法吗?有什么想法吗?

在客户端,您可以连接Sys.WebForms.PageRequestManager BeginRequest:

<script type="text/javascript" language="javascript">
                Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
                Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                function BeginRequestHandler(sender, args)
                {
                     var elem = args.get_postBackElement();
                     ActivateAlertDiv('visible', 'AlertDiv', elem.value + ' processing...');
                }
                function EndRequestHandler(sender, args)
                {
                     ActivateAlertDiv('hidden', 'AlertDiv', '');
                }
                function ActivateAlertDiv(visstring, elem, msg)
                {
                     var adiv = $get(elem);
                     adiv.style.visibility = visstring;
                     adiv.innerHTML = msg;                     
                }
            </script>

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
函数BeginRequestHandler(发送方,参数)
{
var elem=args.get_postBackElement();
ActivateAlertDiv('visible','AlertDiv',elem.value+'processing…');
}
函数EndRequestHandler(发送方,参数)
{
ActivateAlertDiv('hidden','AlertDiv','');
}
函数ActivateAlertDiv(visstring、elem、msg)
{
var adiv=$get(要素);
adiv.style.visibility=visstring;
adiv.innerHTML=msg;
}

更多信息:

可能有助于为您指明正确的方向: