ASP.NET中radiobuttonlist的SelectedIndexChanged事件我怎么击活不了呀?

ASP.NET中radiobuttonlist的SelectedIndexChanged事件,我写了以下的代码,希望修改了radiobuttonlist就出现hello字符串,可是我运行后,程序一点反应都没有。

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
Dim colArrayList As ArrayList
If Not IsPostBack Then
colArrayList = New ArrayList
colArrayList.Add("A、")
colArrayList.Add("B、")
colArrayList.Add("C、")
colArrayList.Add("D、")
RadioButtonList1.DataSource = colArrayList
RadioButtonList1.DataBind()
End If
End Sub

Private Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged
Response.Write("hello")
End Sub
谢谢,问题解决了,不过还想再问一下,如果客户端不支持javascript ,那这个事件还是没法击活是不是?那在客户端不支持javascript 时,有没有其它途径呢?一般的浏览器是不是都支持javascript?什么情况下不支持?

服务端解决方案:你将colArrayList 的AutoPostBack属性设置为true;
客户端解决方案:用javascript
假设colArrayList.Attribute.Add("onchange","document.body.appendChild(document.createTextNode('hello'))");
当你的colArrayList改变以后,页面不会提交,客户端会直接在文档结尾写hello。

基本上现在浏览器都支持javascript。如果不支持,.net的验证机制应该完全没有办法用了。
估计只能用最基本的Post提交了,然后全部服务端验证。
也就是只能用type="submit"的button来提交了。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2007-07-19
AutoPostBack = true本回答被提问者采纳