lundi 22 août 2016

How to Check if RadioButton-Item is selected after PageLoad?

My RadioButtonList is created with pure asp.net like this:

<asp:RadioButtonList ID="RadioButtonListGutscheinArt" Visible="true" runat="server" ClientIDMode="Static">
     <asp:ListItem ID="ListItemZugAbonnement" ClientIDMode="Static" Value="1" />
     <asp:ListItem ID="ListItemBestellungHalbtax" ClientIDMode="Static" Text="Bestellung Halbtax" Value="2" />
</asp:RadioButtonList>

When my page reloads, the ListItemBestellungHalbtax will be selected. Now i want to check if it's actually selected with javascript. I tried it like this:

    if ($('#ListItemBestellungHalbtax').is(":checked")) 
    {
         //do whatever
    }

With no success.. Any suggestions?

Maybe it doesnt work, because the ListItem-Selection is not "saved". Even tough it is clearly visible that it's selected....

Aucun commentaire:

Enregistrer un commentaire