asp.net->取消选中先前选中的单选按钮 [英] asp.net--> to unchecked previously checked radio button

查看:78
本文介绍了asp.net->取消选中先前选中的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个接受用户信息(包括性别)的表格.然后将这些数据输入数据库.为了捕获性别,我使用了带有两个选项的单选按钮列表,无论是男性还是女性,都迫使用户选择其中之一.在成功隐藏用户信息后,我真正有可能取消选中选定的单选按钮.请给我适当/容易/提示的信息以进行同样的操作
thanku
anoop

解决方案

Anoop,

您可以将radiobuttonlist.selectedIndex = -1设置为清除选择.

谢谢,
Swapnil.


RadioButtonList 具有方法ClearSelection.

 受保护的 无效 Save_Click(对象发​​件人,EventArgs e)
       {
           sexlist.ClearSelection();
       } 



这样可以解决您的问题.


hi i have a form which takes user information including its gender. this data is then fed into database. to capture gender i have use radiobutton list with two options either male or female forcing user to select one of them. what i really is is possible to unchecked the selected radiobutton after user information has beem sucessfully caputred. plz provide me with the proper/easy/hint to do the same
thanku
anoop

解决方案

Hi Anoop,

You can set radiobuttonlist.selectedIndex = -1 to clear selection.

Thanks,
Swapnil.


RadioButtonList has a method ClearSelection.

protected void Save_Click(object sender, EventArgs e)
       {
           genderlist.ClearSelection();
       }



This will resolve your issue.


这篇关于asp.net->取消选中先前选中的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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