如何计算asp.net中的网页加载量 [英] How do I count the page load in asp.net
本文介绍了如何计算asp.net中的网页加载量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我禁用页面加载上的按钮.并且我的程序执行所有活动,并且应该启用该按钮.但在重新加载页面时,该按钮将被禁用.所以我想计算页面负载并设置一个条件,例如count(page load)大于一个,然后不要禁用它.我怎么做?我可以得到代码吗?我尝试了一下却没有用
Im disable a button on pageload. and my program does all the activities and it should enable the button . but the button is disabled back as the page reloads. so i want to count the page load and put a condition like if the count( page load) is more than one then dont disable it . how do i do that? can i get the code please. i tried it nothing worked
推荐答案
只需将您的代码放入
如果不是pageIsPostBack,则
您的验证码...
ENdIf
Just put Your Code in
If Not pageIsPostBack then
Your Code...
ENdIf
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Application["visits"] == null)
{
Application["visits"] = 1;
}
else
{
int visits = (int)Application["visits"];
visits++;
Application["visits"]=visits;
if (visits > 1)
{
myButton.Enabled = true;
}
}
}
}
这篇关于如何计算asp.net中的网页加载量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文