支持基于单选按钮来选择文本框中 [英] Enable text box based on radio button selected
问题描述
我有列出不同的业务类别的一个单选按钮列表。最后一个选项是其他
类别。当用户选择了其他
类,我希望能够使一个文本框,用户可以再输入更多的信息,解释其他
的选择。
I have a Radio Button List that lists different business categories. The last option is the Other
category. When the user selects the Other
category, I want to be able to enable a text box that the user can then enter further information to explain the Other
selection.
目前,我试图
If rblCategory.SelectedIndex = 20 Then
txtOther.Enabled = True
lblOther.Text = rblCategory.SelectedItem.Text()
End If
在此摘录,我这基础上的索引,但我也试着使其基于文本字段和值字段中,但我仍然没有得到它的工作。有什么建议?
In this excerpt, I am basing it on the index, but I've also tried basing it on the Text field as well as the Value field, but I still have not gotten it to work. Any suggestions?
推荐答案
如果您的断点没有被击中,这是一个很好的线索,更大的东西是错误的。做你与已ViewStateEnabled工作的控件=真的吗?对于一个单选按钮列表,我想你可能需要设置的CausesValidation = true,并且还的AutoPostBack =真。某些控件不回发默认情况下,我认为这可能是其中之一。
If your breakpoints aren't being hit, that is a good clue that something bigger is wrong. Do all of the controls you are working with have ViewStateEnabled=true? For a radio button list, I think you may need to set CausesValidation=true, and also AutoPostBack=true. Some controls do not post back by default and I think that may be one of them.
这篇关于支持基于单选按钮来选择文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!