验证aspx页面 [英] validation for aspx page

查看:83
本文介绍了验证aspx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个aspx页面,其中包含不同的部分,例如PartA,PartB,PartC,PartD.每个部分在文本框中显示不同的数据.有一个保存"按钮会将整个页面数据保存到数据库.

如果用户未更改页面上的任何内容,然后按保存"按钮,则需要显示弹出窗口,显示未发生任何更改"

哪种方法最好?

感谢

Hi All,

I have one aspx page which has different parts like PartA, PartB, PartC, PartD. Each part has different data showed in text boxes. There is one Save button which will save the entire page data to the database.

If user doesn''t change any thing on page and press "Save" button, need to show the popup showing that "No changes happen"

What Approach should be the best?

Thanks

推荐答案

一种选择是将现有数据存储在javascript变量中,并在提交表单时比较数据.如果数据相同,则向用户显示警告框.

另一种选择是使用隐藏字段并比较数据.

您还可以提交表单并进行比较,并显示消息而不是警告(但这将需要服务器跳闸).
One option is to store the existing data in javascript variables and when form is submitted, compare the data. If the data is same then show alert box to user.

Another option is to use hidden fieldand comparing the data.

you can also submit the form and do the comparision and show the message instead of alert (but this will need a server trip).


您好,Laxmikant,
javascript是您问题的答案;)
步骤1)将文本框的所有值保存在hiddefield中,将txtbox1的值保存在hdntxtbox1中
步骤2)
一个.在所有文本框的onchange事件上编写一个独特的JavaScript函数,说ISdatachange(agr)
b.检查是否对应的文本框的值与其对应的hiddenfield的值相同,如果不将某些globalvariable的值更改为_GblVar则为1,如果其值为零

第3步)单击保存"按钮,检查_GblVar值是否为1,则显示警报,否则不显示.

希望这可以帮助您让我知道是否需要任何澄清:)

享受生活;)
Hi Laxmikant,
javascript is the answer to your question ;)
Step 1) Save all the value of textboxes in hiddefield say value of txtbox1 in hdntxtbox1
Step2)
a. Write a unique javascript function say ISdatachange(agr) on the onchange event of all the text box
b. check is the value of corresponding textbox is same as that of its corresponding hiddenfield if not change the value of some globalvariable say _GblVar to 1 if its zero

Step 3)On click of save button check if _GblVar value is 1 show the alert else not.

Hope this will help you let me know if you need any clarification :)

Enjoy Life ;)


这篇关于验证aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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