I have a custom radiobutton below inside of a repeater and when a user clicks it, it is supposed to fire the code behind, however this is not firing at all. I've placed a breakpoint at the beginning of the method and it isnt ever reached. The only thing that does happen is a postback of the updatepanel
<EclipseUI:CustomRadioButton runat="server" ID="RadioButton_Select"
ClientIDMode="AutoID" ToolTip='<%# "id_" + Eval("FeaturePackId") %>' GroupName='<%# "id_" + Eval("FeaturePackId") %>'
OnCheckedChanged="RadioButton_Select_OnCheckedChanged" AutoPostBack="True"/>
The code behind is simply this, it takes the value of each checked radiobutton and places it in a hidden field for use later.
protected void RadioButton_Select_OnCheckedChanged(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
sb.Clear();
foreach (RepeaterItem repeaterItem in Repeater_Select.Items)
{
CustomRadioButton radioButton = repeaterItem.FindControl("RadioButton_Select") as CustomRadioButton;
if (radioButton != null)
{
if (radioButton.Checked)
{
sb.Append(radioButton.GroupName.Substring(4));
}
else
{
sb.Replace(radioButton.GroupName.Substring(4), "");
}
}
}
HF_Feature.Value = sb.ToString();
}
My problem is that this doesnt fire at all.
EDIT
My code is now as follows, and the item databound event is hit and so is the += assignment of the eventhandler to the radiobutton but clicking the radiobutton still doesnt hit my breakpoint in the OnCheckedChange of the radiobutton method:
protected void Page_Load(object sender, EventArgs e)
{
Repeater_Select.ItemDataBound += new RepeaterItemEventHandler(Repeater_Select_OnItemDataBound);
}
protected void Repeater_Select_OnItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
CustomRadioButton customRbtn = (CustomRadioButton)e.Item.FindControl("RadioButton_Select");
customRbtn.CheckedChanged += new EventHandler(RadioButton_Select_OnCheckedChanged);
}
}
But it is still not working