asp.net radio button grouping

后端 未结 10 478
余生分开走
余生分开走 2020-12-05 09:47

I am currently having an issue with radio buttons and grouping. I have an asp radio button within a repeater control. I have the group name attribute set to \"Customer\". Wh

10条回答
  •  死守一世寂寞
    2020-12-05 10:22

    My solution, similar to others:

    
    
    // Fixes this ASP.NET bug: if radio input is inside repeater you can't set its name.
    // Every input gets set different name by ASP.NET.
    // They don't behave as a group. You can select multiple radios.
    function fixRadiogroupBug()
    {
        $('[type="radio"][data-fixgroupbug]').click(function () {
            $(this).siblings('[type="radio"]').prop('checked', false);
        });
    }
    
    $(document).ready(function () {
        fixRadiogroupBug();
    });
    

提交回复
热议问题