回发,客户端脚本,服务器端和客户端控件同步 [英] Postback, Clientside script, Serverside and Clientside controls, get synchronized

查看:84
本文介绍了回发,客户端脚本,服务器端和客户端控件同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我遇到了种种情况.这是我面临的问题,其中的字段分为两个验证方案.我使用了customvalidator控件来处理我遇到的情况,同时使用单选按钮在用户之间进行了交替.两个字段组中的任何一个都必须一次填写.直到页面回发(去到服务器),此方法才能正常工作.但是,返回页面后,它将无法正常工作.两个单选按钮都松开它们的状态,并且所有内容都变为可用(活动),因此可以填充两个不需要的字段组.单选按钮是html控件,而customvalidator是asp.net控件.我使用javascript和jquery来完成此操作.

这些字段和单选按钮也在updatepanel控件中.

如果有任何混淆,请告诉我.

非常感谢,

Hallo everyone,

I have got a situation on which I get stacked. Here is what I faced, there are fields which are grouped into two validation scenarios. I used customvalidator control for the situation I have, along with radio buttons are used to give the user alternation between. Either of the two field groups have to be filled out at a time. This works fine until the page is posted back (gone to server). When the page get returned, however, it wouldn''t work properly. Both the radio buttons loose their states and everything become available (active), so that it will be possible to fill both field groups which is not wanted. The radio buttons are html controls, and the customvalidator is an asp.net control. I used javascript and jquery for this operation to be met.

The fields and the radio buttons are in updatepanel control, also.

Please let me know, if there is any confusion.

Many thanks,

推荐答案

HTML控件无法维持状态.所以可以这样..
1)当页面回发时,将单选按钮存储在隐藏字段中,然后在隐藏字段中显示所选的单选按钮
2)您是否尝试过将HTML单选按钮设置为runat ="server"
Html control could not maintain state. So could do like this..
1) When page is postback, store the radio button in hidden field then show the selected radion button against hidden field
2) Have u tried to make html radio buttons runat="server"


这篇关于回发,客户端脚本,服务器端和客户端控件同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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