如何识别字段值在ASP.Net已经改变 - C#? [英] How to identify field value has changed in ASP.Net - C#?

查看:108
本文介绍了如何识别字段值在ASP.Net已经改变 - C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ASP.NET的页面,要求是很常见的,当窗体打开进行编辑,如果用户在页面上改变任何领域的价值,并点击取消,那么code不禁要问网友认为有一些改变的值是否要继续。在节约是将被丢弃。
此外,如果用户不进行更改形成将不会显示警报消息。我需要它的C#,如果可能的话。

I have a page in asp .net , requirement is very common, when the form is open for editing if a user changes value of any of the field on the page and click on cancel , then the code must ask user that "There are some changed value do you want to continue.". On yes saving will be discarded . Also if user do not make changes form will not show the alert message. I need it c# , if possible.

推荐答案

这听起来象是在客户端应该发生 - 无需干预ASP.NET此处

This sounds like something that should happen on the client side - no need for ASP.NET intervention here.

我会做的是输入字段线向上变动的事件。当一个领域发生了变化,设置一个全局变量。

What i would do is wire up change events for the input fields. When a field has changed, set a global variable.

然后在取消按钮的的onclick 的事件,调用一个JavaScript函数,如果变量设置,显示消息框。

Then on Cancel button onclick event, call a JavaScript function, if the variable is set, show the message box.

这篇关于如何识别字段值在ASP.Net已经改变 - C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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