Reputation:
So I have a radiobuttonlist inside an updatepanel. I seem to be hitting a really simple yet vexing problem -
Even though I've set AutoPostBack=true, when I click on a radio button, I see the postback happen but the SelectedIndexChanged event does not fire at all. Not only that, even in the postback, when I check SelectedIndex it shows -1 instead of the button I clicked.
this is so annoying and I don't know what I'm doing wrong. It's plain and simple postback and server side processing to know which radio button in the list got clicked, there is nothing fancy in the code on either the server or client sides.
Please help!
(PS - I tried with/without adding the rbList control and the SelectedIndexChanged as triggers for the update panel and it still doesn't work..the SelectedIndexChanged does not fire)
Upvotes: 0
Views: 1288
Reputation:
OK, I don't know what the deal was - but I fixed it. Perhaps some others facing similar issues will find it helpful.
I was modifying the text property of the rbList,
e.g. rbList.Items[0].Text = "xxx"
and for whatever reason, this will killing the overall functionality. So finally I figured that this piece of code was causing issues, so I replaced it with
rbList.Items.Add(text,value)
and it started working, Also note that when I had rbList.Items.Add(text), it was causing problems as well!
no idea - but whatever, it fixed it.
Upvotes: 0
Reputation: 18491
Try testing it outside the UpdatePanel
to see if in a non-ajax situation it does fire. Maybe your mistake is somewhere else.
Upvotes: 0