如何在asp.net中获得响应时间。 [英] how to get response time in asp.net.

查看:48
本文介绍了如何在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());

}

解决方案

get(' container')。style.cursor = ' wait';


find(' mdlPopupPleasewait')。节目();
}



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());

}


我对你到底在做什么感到困惑,但我会做出一些假设。 br />


如果您使用UpdatePanel来执行AJAX回发,则可以使用UpdateProgress控件在指定的时间(例如,2秒)后显示某些内容。 br />


假设您有一个名为 upSearch 的UpdatePanel,您的UpdateProgress控件将如下所示:

 <   asp:UpdateProgress     runat   = 服务器    AssociatedUpdatePanelID   =   upSearch    DisplayAfter   =  2000 >  
< ProgressTemplate >
< div class = search_progress >
正在更新...
< / div >
< ; / ProgressTemplate >
< / asp:UpdateProgress >


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[&quot;Request_Start_Time&quot;]);
          Context.Response.Write(&quot;&lt;b&gt;Request Processing Time: From Global.asax file &quot; + tsDuration.ToString());

      }

解决方案

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[&quot;Request_Start_Time&quot;]);
          Context.Response.Write(&quot;&lt;b&gt;Request Processing Time: From Global.asax file &quot; + tsDuration.ToString());

      }


I''m a little confused about what exactly you are doing, but I''ll make some assumptions.

If you are using an UpdatePanel to do your AJAX postbacks, you can use an UpdateProgress control to show something after a specified number of time (e.g., 2 seconds).

Supposing you have an UpdatePanel called upSearch, your UpdateProgress control would look something like this:

<asp:UpdateProgress runat="server" AssociatedUpdatePanelID="upSearch" DisplayAfter="2000">
  <ProgressTemplate>
    <div class="search_progress">
      Updating...
    </div>
  </ProgressTemplate>
</asp:UpdateProgress>


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆