ASP.NET 4.0 Radio button checked changed event fires only once

后端 未结 1 1746
终归单人心
终归单人心 2021-01-19 08:39

I have two radio buttons both set as async triggers for an update panel and problem is that first time one is clicked the CheckedChanged event fires but then no matter which

1条回答
  •  借酒劲吻你
    2021-01-19 09:11

    Looking at the source (in the browser), ASP.NET is only generating a post back function __doPostBack for the RadioButton controls which can possibly postback.

    The first RadioButton control cannot postback (because it is already checked), and as such the __doPostBack is not generated.

    A work around is to add the two RadioButton controls to another UpdatePanel, setting the UpdateMode to Always. This will cause the RadioButtons to be updated (whenever they trigger the other UpdatePanel) adding the __doPostBack function to the deselected RadioButton.

    Example

    
        
            
                        
        
    
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题