本文介绍了单选按钮列表里面直放站OnSelectedIndexChanged不点火的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个中继器内的单选按钮列表。我的AutoPostBack设置为true,并定义的OnSelectedIndexChanged。当我在列表中选择一个不同的单选按钮的页面不回发,但我的定义OnSelectedIndexChanged事件不捕或射击。不知道我错过了什么。这是我的标记和codebehind:
I have a RadioButtonList inside a Repeater. I have AutoPostback set to "true" and the OnSelectedIndexChanged defined. When I selected a different radiobutton in my list the page does postback, but my defined OnSelectedIndexChanged event is not catching or firing. Not sure what I am missing. Here is my markup and codebehind:
推荐答案
使用中继器的ItemCreated事件到你的事件处理程序绑定:
Use the repeater's itemcreated event to bind your eventhandler:
protected void Repeater!_ItemCreated(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
e.item.FindControl("TaskRadioButtonList").SelectedIndexChanged += new EventHandler(TaskRadioButtonList_OnSelectedIndexChanged);
}
}
这篇关于单选按钮列表里面直放站OnSelectedIndexChanged不点火的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!