The code is fine by the looks, but you will need to store the new button data some where. What is happening is that "newEmail" is being replaced by the new data. As this code is being processed, the program has no place to store the old "newEmail", so instead it is replacing the value and then replacing the instance. I would suggest adding the new radios to a database and then recalling them with a foreach statement.
RadioButtonList does not update correctly inside callback
-
11-10-2022 - |
Pergunta
I am trying to update my RadioButtonList
dynamically within a callback (devexpress callbackpanel).
When I run the following it does work, however it does not append. It seems to replace the last item in the RadioButtonList.
*Note: emailRadioList
is populated in Page_Load
within a (!IsCallback)
conditional.
protected void ClbkAddEmail(object source, CallbackEventArgsBase e)
{
ListItem newEmail = new ListItem(tbAddEmail.Value.ToString(), result.ToString());
emailRadioList.Items.Add(newEmail);
}
The callback will add one item to the radiobuttonlist and only replace afterwards.
For example:
(begin)
- radio1
- radio2
- radio3
(first callback)
- radio1
- radio2
- radio3
- radio4
(second callback)
- radio1
- radio2
- radio3
- radio5
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow