本文介绍了如何在asp.net中获得响应时间。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望当用户点击按钮,链接按钮或tabcontainer时,应显示加载图像,但如果响应时间小于2秒,则gridview将完全加载&显示,那个时候我不想要加载图片应该显示。

i我通过javascript显示加载图片,因为



 function onBeginRequest()
{
$ get(' container')。style.cursor = ' wait';
$ find(' mdlPopupPleasewait')。show();
}



i做了一些rnd我发现了这个

  protected   void  Application_BeginRequest( object  sender,EventArgs e)
{
Context.Items.Add( Request_Start_Time,DateTime.Now);
}
受保护 void Application_End( object sender,EventArgs e)
{
TimeSpan tsDuration = DateTime.Now.Subtract((DateTime)Context.Items [& quot; Request_Start_Time& quot;]);
Context.Response.Write(& quot;& lt; b& gt;请求处理时间:来自Global.asax文件& quot; + tsDuration.ToString());

}
解决方案




hi,i want when a user click on the button,linkbutton or tabcontainer a loading image should be display,but if the response time is less than 2 sec for a gridview to get fully loaded & displayed,that time i dont want the loading image should be display .
i am showing the loading image through javascript,as

function onBeginRequest() 
{      
        $get('container').style.cursor = 'wait';
        $find('mdlPopupPleasewait').show();
}


i did some rnd and i found this

protected void Application_BeginRequest(object sender, EventArgs e)
        {
            Context.Items.Add("Request_Start_Time", DateTime.Now);
        }
protected void Application_End(object sender, EventArgs e)
      {
          TimeSpan tsDuration = DateTime.Now.Subtract((DateTime)Context.Items["Request_Start_Time"]);
          Context.Response.Write("<b>Request Processing Time: From Global.asax file " + tsDuration.ToString());

      }
解决方案




这篇关于如何在asp.net中获得响应时间。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 17:23