仅将更改的控制值传递给另一个页面(c#.net) [英] Pass only changed control values to another page (c#.net)
本文介绍了仅将更改的控制值传递给另一个页面(c#.net)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我在一个asp.net页面中有500个控件。
包括文本框,下拉列表,复选框,单选按钮等。
我已经更改了2或3个控件的值。
现在,在提交按钮单击时,我将传递这些控件的值,其值为改变。 (比如这里2或3)
如何做到这一点..?请尽快帮助
我的尝试:
我曾想过在一个面板中声明这些控件,但我不知道实现这个的正确方法是什么。
Suppose I've 500 controls in one asp.net page.
which includes textboxes, dropdownlists, checkboxes, radiobuttons etc..
I've changed value of 2 or 3 controls.
Now, on submit button click, I've to pass the values of those controls, whose values are changed. (like here 2 or 3)
how to do this..? please help ASAP
What I have tried:
I've thought of declaring those controls inside one panel, but I don't know what would be the right approach to achieve this.
推荐答案
你可以通过比较输入的defaultValue,defaultChecked for checkboxes和defaultSelected for select以及它们的实际值/ checked / selected属性来跟踪更改,这样你就可以得到它们。
一篇文章 - 跟踪控件的修改值在网页 [ ^ ]
You can track changes by comparing the defaultValue for inputs, defaultChecked for checkboxes and defaultSelected for select with their actual value/checked/selected property so that you can get only them.
One article - Keep Track of Modified Values of Controls in a Web Page[^]
有字典。
更改每个控件时,添加控件的id和和词典的价值。
提交时,发送t他将字典改为下一页。
Have a dictionary.
On change of each control, add the control's id and and value to the dictionary.
When Submit, send the dictionary to the next page.
这篇关于仅将更改的控制值传递给另一个页面(c#.net)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文