如何动态地跟踪对ASP .NET按钮点击次数 [英] How to dynamically keep track on button click count on ASP .NET

查看:115
本文介绍了如何动态地跟踪对ASP .NET按钮点击次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要的一种形式,人们可以注册为一疗程。人数为一疗程是有限的。我想打一个网页,用户可以看到有多少地方仍然可用,这个数字是动态更新的,因此,如果其他用户的标志为一疗程其他人看到的变化。当宿位数目达到0的注册按钮应该被禁用。这样的任务应该是很容易实现,但恐怕不是。我想一些Ajax会参与,但如何处理服务器端计算? Web服务?我有一个问题,设计逻辑背后的这一切。

I want to make a form where people can sign up for a course. Number of people for a course is limited. I want to make a page where user can see how many places are still available and that number is dynamically updated, so if another user signs for a course the other one sees change. When number of available places reaches 0 the signup button should be disabled. Such task should be easy to implement but I am afraid it is not. I suppose some Ajax will be involved but how to handle server side counting? WebServices? I have a problem to design a logic behind all of this.

推荐答案

您正在寻找被称为服务器推送技术/技术。

The technology/technique you're looking for is called Server Push.

基本理念:客户应响应某些事件发生在服务器

Basic idea: Client should respond to some events happening on Server.

可能的解决方案:

  1. 在轮询及时通过AJAX一些服务器操作;
  2. 在保持长时间运行AJAX请求服务器端打开,直到发生超时或事件发生,然后在客户端过程中获得的结果(确定它是否是服务器操作,或只是暂停),重新建立必要时,从客户端连接。

和几个其他的解决方案,基本上是上述两种变化。同样的解决方案将很大程度上取决于你使用服务器端的技术。

and a couple of other solutions which are basically variations of the above two. Also solution will much depend on server-side technology you're using.

谷歌有什么这项技术是一个简短但非常丰富的文章,以及它如何可以实施的此处。这是(几乎)技术无关,所以应该帮助你理解的概念和可能的解决方案。

Google has a short yet very informative article on what this technique is and how it can be implemented here. It's (almost) technology agnostic so it should help you to understand concepts and possible solutions.

这篇关于如何动态地跟踪对ASP .NET按钮点击次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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