如何判断一个刷新来自一个计时器(C#)计时器、如何判断

2023-09-10 21:46:56 作者:我的心已经成了你的殖民地

我有一吨的更新面板和等在我的网页表单(这是在运行时动态创建的)

I have a ton of update panels and such on my webform (which are created dynamically at runtime)

我想提出一个锁定计时或类似的东西在我的形式也。我的问题是这样的。当有人输入到一个文本框,并定时发生,他们失去了自己的文字部分和控制失去焦点。

I am wanting to put a locking timer or something similar in my form also. My problem is this. When someone is typing into a text box, and the timer happens they lose part of their text and the control loses focus.

出现这种情况的原因是因为在后背部有些事情做,屏幕重建和当前的控制面板被更新。出现这种情况的原因是因为这会导致页面的唯一的东西,以获得在此之前,计时器刷新分别对控制(在哪些东西需要检查和更新)变更事件。所以,我需要的是要知道,如果这个锁定时器是什么原因造成的刷新,这样我就不会重建屏或触摸任何东西之类的。我不能等到它到达Tick事件因为当时它的存在的屏幕已经重建,弄乱了用户。

The reason this happens is because on post back some things are done and the screen is rebuilt and the current control panel is updated. The reason this happens is because the only things that would cause the page to get refreshed prior to this timer were Change events on the controls(in which things need to be checked and updated). So what I need is to know if this Lock Timer is what caused the refresh so that I don't rebuild the screen or touch anything else like that. I can't wait until it gets to the Tick event because by the time it's there the screen has already been rebuilt and messed up for the user.

另外,我不能使用视图状态或其他任何魔法,​​因为屏幕重建在Page_Init。我查了一下,如果发送者会说,计时器,但只给出了当前页面。

Also, I can't use viewstate or any other magic, as the screen is rebuilt at Page_Init. I checked if sender would say the timer, but it only gives the current page..

所以我的问题是这样的:

So my question is this:

你怎么判断一个刷新发生的原因是因为在Page_Init更新计时器?

How do you tell if the reason a refresh happened is because of an update timer at Page_Init?

推荐答案

怎么样的Request.Form [__ EVENTTARGET]?

How about Request.Form["__EVENTTARGET"]?