When using the following code, this error is returned:
‘rblPermisSejourA’ has a SelectedValue which is invalid because it does not exist in the list of items.
<asp:RadioButtonList ID="rblPermisSejour" runat="server"
DataSourceID="EntityDataSourcePermisSejour" DataTextField="Libelle"
DataValueField="Id" AppendDataBoundItems="True" RepeatDirection="Horizontal">
<asp:ListItem Selected="True" Text="" Value="-1">Aucun</asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButtonList ID="rblPermisSejourA" runat="server"
DataSourceID="EntityDataSourcePermisSejour" DataTextField="Libelle"
DataValueField="Id" AppendDataBoundItems="True" RepeatDirection="Horizontal">
<asp:ListItem Selected="True" Text="" Value="-1">Aucun</asp:ListItem>
</asp:RadioButtonList>
protected void ws2_OnDeactivate(object sender, EventArgs e)
{
rblPermisSejourA.SelectedValue = rblPermisSejour.SelectedValue;
}
Note that “rblPermisSejour” is in a wizard step and “rblPermisSejourA” in another wizard step that is not yet activated (no id and no title for the step in witch there is the “rblPermisSejourA”). When this step is activated, all is working well.
But with the same code and same operation with another RadioButtonList it’s working very well and this within the same context (wizard step not activated).
This is THE solution: