Problems with radiobutton in table(TR for each one) - Accepts that all are clicked

Asked

Viewed 181 times

1

I have this table and these radios Buttons. I happen to select more than one radiobutton, it does not obey the question, from one selected the other does not.

<table>
                <tr>
                    <td>@Html.RadioButton("Improdutivo-Reagendar","Improdutivo-Reagendar")Improdutivo-Reagendar</td>
                </tr>
                <tr>
                    <td>@Html.RadioButton("Improdutivo-PDV Não Apto","Improdutivo-PDV Não Apto")Improdutivo-PDV Não Apto</td>
                </tr>
                <tr>
                    <td>@Html.RadioButton("Improdutivo-Comercial","Improdutivo-Comercial")Improdutivo-Comercial</td>
                </tr>
                <tr>
                    <td>@Html.RadioButton("Improdutivo-Infra Estrutura","Improdutivo-Infra Estrutura")Improdutivo-Infra Estrutura</td>
                </tr>
                <tr>
                    <td>@Html.RadioButton("Finalizado","Finalizado")Finalizado</td>
                </tr>
            </table>
  • you can explain a little better what is happening, maybe add something similar print ?

  • They must have the same name and values representing each.

  • Otto, I can, for example, click and check them all at once. As for Fccdias, how I assign a name to Radiobutton created by Helpers(@Html.Radiobutton)?

1 answer

3


All must possess the same name and the value are different for you to recover such value, that is, for you to select only one of the values the name is obligatorily equal. If you’re going to produce another radio group put another name and so on

<table>
    <tr>
        <td>@Html.RadioButton("selecao", "Improdutivo-Reagendar")Improdutivo-Reagendar</td>
    </tr>
    <tr>
        <td>@Html.RadioButton("selecao", "Improdutivo-PDV Não Apto")Improdutivo-PDV Não Apto</td>
    </tr>
    <tr>
        <td>@Html.RadioButton("selecao", "Improdutivo-Comercial")Improdutivo-Comercial</td>
    </tr>
    <tr>
        <td>@Html.RadioButton("selecao", "Improdutivo-Infra Estrutura")Improdutivo-Infra Estrutura</td>
    </tr>
    <tr>
        <td>@Html.RadioButton("selecao", "Finalizado")Finalizado</td>
    </tr>
</table>

Reference

  • When I mentioned the comment, the answer was not yet for me. Now it solved everything.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.