如果值更改,如何强制提交 [英] How to force submit if values change

查看:55
本文介绍了如果值更改,如何强制提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET数据网格,它有一列下拉列表控件。如果

用户在一行或多行的下拉列表中更改了值,我将设置一个

标志。如果用户随后尝试(1)离开页面,或2)关闭窗口,我想提出一个警告提醒他们首先提交他们的

数据。


任何人都知道怎么做?


TIA,

杜威

I have a .NET datagrid that has a column of dropdownlist controls. If the
user changes the value in the dropdown in one or more rows I will set a
flag. If the user subsequently attempts to (1) leave the page, or 2) close
the window, I want to present an Alert reminding them to first submit their
data.

Anyone know how to do this?

TIA,
Dewey

推荐答案

DJ写道:
我有一个.NET数据网格,它有一列下拉列表控件。如果
用户更改了一行或多行的下拉列表中的值,我将设置一个
标志。如果用户随后尝试(1)离开页面,或2)关闭窗口,我想提出警告提醒他们首先提交他们的
数据。

有谁知道怎么做?
I have a .NET datagrid that has a column of dropdownlist controls. If the
user changes the value in the dropdown in one or more rows I will set a
flag. If the user subsequently attempts to (1) leave the page, or 2) close
the window, I want to present an Alert reminding them to first submit their
data.

Anyone know how to do this?




是的。


你有什么尝试?


我会尝试onunload事件,然后调用confirm()(NOT

alert())方法。然后根据你想要分支的方式,在确认()

返回true(用户点击OK)或false(用户点击取消)时,调用

适当形式''submit()方法。


HTH



Yes.

What have you tried?

I would try an onunload event that in turn calls the confirm() (NOT
alert()) method. Then depending on how you want to branch, on confirm()
returning true (user hits "OK") or false (user hits "Cancel"), call the
appropriate form''s submit() method.

HTH


2004年2月20日星期五23:59: 16 -0600,DJ< re *** @ group.net>写道:
On Fri, 20 Feb 2004 23:59:16 -0600, DJ <re***@group.net> wrote:
我有一个.NET数据网格,它有一列下拉列表控件。如果用户更改了一行或多行的下拉列表中的值,我将设置一个标志。如果用户随后尝试(1)离开页面,
或2)关闭窗口,我想提出警告提醒他们首先提交他们的数据。

有人知道怎么做吗?
I have a .NET datagrid that has a column of dropdownlist controls. If
the user changes the value in the dropdown in one or more rows I will
set a flag. If the user subsequently attempts to (1) leave the page,
or 2) close the window, I want to present an Alert reminding them to
first submit their data.

Anyone know how to do this?




我非常怀疑它。


如果这是用于互联网,那么它不可能。 onunload事件是

关于我能看到的唯一选项,但并非所有浏览器在相同条件下触发该事件




如果这是针对内联网或其他一些受限制的环境,并且你可以保证你的用户拥有Mozilla或Internet Explorer,那么你可以使用BODY标签中的onunload事件,您可以执行这些检查。但是,您无法阻止浏览器关闭。即使

你可以检查页面的状态,你也许无法做任何事情

:浏览器正在关闭,所以它不太可能开始新的

连接。更改页面时行为可能类似。


特别是这些浏览器的原因是因为,我可以使用
(Netscape, Mozilla,IE和Opera),只有在关闭时才会触发
onunload。当然可能还有其他浏览器。


你最好的办法是向你的用户明确说明关闭或导航

而不保存会导致数据损失。


迈克


-

Michael Winter
M。****** @ blueyonder.co.inva 盖子(将.invalid替换为.uk以回复)



I very much doubt it.

If this is for the Internet, then it''s impossible. The onunload event is
about your only option I can see, but not all browsers fire that event
under the same conditions.

If this is for an Intranet, or some other restricted environment, and you
can guarantee that your users have either Mozilla or Internet Explorer,
then you can use the onunload event in the BODY tag where you can perform
those checks. However, you can''t prevent the browser from closing. Even if
you can check the state of the page, you might not be able to do anything
anyway: the browser is closing, so it''s not likely to start opening new
connections. The behaviour will probably be similar when changing pages.

The reason for those browsers in particular is because, out of the ones I
have available (Netscape, Mozilla, IE and Opera), only they will fire
onunload when closing. There might be other browsers, of course.

Your best bet is to make it clear to your users that closing or navigating
away without saving will cause data loss.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)


2004年2月21日星期六15:33:20 GMT,迈克尔·温特

< M。****** @ blueyonder.co.invalid>写道:
On Sat, 21 Feb 2004 15:33:20 GMT, Michael Winter
<M.******@blueyonder.co.invalid> wrote:
2004年2月20日星期五23:59:16 -0600,DJ< re *** @ group.net>写道:
On Fri, 20 Feb 2004 23:59:16 -0600, DJ <re***@group.net> wrote:




[snip]



[snip]

任何人都知道怎么做?



我非常怀疑。



I very much doubt it.




[snip]


哎呀。我出于某些奇怪的原因读到了这个问题,因为:这可以吗?

完成了吗?


迈克


-

Michael Winter
M。***** *@blueyonder.co.inva 盖子(将.invalid替换为.uk以回复)



[snip]

Oops. I read that question, for some bizarre reason, as: "Can this be
done?"

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)


这篇关于如果值更改,如何强制提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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