简体   繁体   中英

Radiobuttonlist changes index on firefox reload

I've an asp page with a DevExpress AspRadioButtonList. On Page_Load the SelectedIndex is set, based on a property variable. On ClientSideEvents SelectedIndexChange some info is changed. All works as it's suppoused to up to this point.

In firefox, if a reload it's triggered, selected radio button circles throught all values. Any one has had a similar issue?

<dxe:ASPxRadioButtonList ID="rbl" runat="server" ClientInstanceName="radiobuttonlist">
    <ClientSideEvents SelectedIndexChanged="secChecks" />
    <Items>
        <dxe:ListEditItem Text="Cms" Value="0" />
        <dxe:ListEditItem Text="News" Value="1" />
        <dxe:ListEditItem Text="Url" Value="3" />
        <%--<dxe:ListEditItem Text="Bussines" Value="2" />--%>            
    </Items>
</dxe:ASPxRadioButtonList>

On Page Load (a is an id parameter)

myClass s = new myClass (a);
            this.rbl.SelectedIndex = s.myProp;
            if (s.myProp== 3)
            {
                this.lbUrl.Text = s.Urlpublic;
            }

Javascript on load:

$(document).ready(function(){
    if (radiobuttonlist.GetSelectedIndex() == 0)
    {        
        $("div.cms").show();            
    }
    else if (radiobuttonlist.GetSelectedIndex() == 3)
    {
        $("div.bussines").show();
    }
    else if (radiobuttonlist.GetSelectedIndex() == 1)
    {
        $("div.news").show();         
    }
    else if (radiobuttonlist.GetSelectedIndex() == 2)
    {
        $("div.url").show();        
    }          

});

Thanks in advance!

I have gotten bit by this as well. I found a solution on:

www.ryancramer.com

Basically, my problem occurred because I was dynamically adding in a flash object before my radio buttons. My understanding is that this problem can occur when adding in input tags as well. When I moved the radio buttons (markup) before the markup that I'm dynamically inserting, it worked fine. If you don't want to move your markup, you can try adding an autocomplete="off" attribute to the surrounding form tag (ie. '').

Both of these solutions worked for me. For more detail, check out the link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM