0

I have the following code:

@using (Html.BeginForm("CreditCard", "Deposit", FormMethod.Post, new { @class = "depositForm" }))
{
    <h2>@WebContent.Get("Self Deposit", "dbns500 - register - claim", false, "CLAIM YOUR BONUS")</h2>
    <div class="clearfix wrp-stap wrp-stap2">
        <i class="fa fa-check" aria-hidden="true"></i><hr />
        <i class="fa fa-check" aria-hidden="true"></i><hr />
        <i class="fa-num" aria-hidden="true">3</i>
    </div>
    <div class="row">
        <div>
            <div data-toggle="buttons">
                <div id="item_container" data-toggle="buttons" class="wrp-buttons">
                    <label class="btn btn-primary">
                        <span class="wrp-text">
                            <span class="title">
                                <b>@Html.RadioButtonFor(a => a.Amount, 200, new { @type = "radio" }) @AmountAndConversion(200)</b>
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - bonus", false, "BONUS")
                            </span>
                            <span class="h6">
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - 200", false, "On a $200 deposit")
                            </span>
                            <i class="fa fa-plus-circle" aria-hidden="true"></i>
                            <span class="h5">
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - FreeBook", false, "A Free ebook")
                                <i class="fa fa-check" aria-hidden="true"></i>
                            </span>
                        </span>
                    </label>
                    <label class="btn btn-primary active">
                        <span class="wrp-text">
                            <span class="title">
                                <b>@Html.RadioButtonFor(a => a.Amount, 500, new { @type = "radio", @checked = "checked" }) @AmountAndConversion(500)</b>
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - bonus", false, "BONUS")
                            </span>
                            <span class="h6">@WebContent.Get("Self Deposit", "dbns500 - deposit - 1000", false, "On a $1000 deposit")</span>
                            <i class="fa fa-plus-circle" aria-hidden="true"></i>
                            <span class="h5">
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - FreeBook", false, "A Free ebook")<br />
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - Free1X1", false, "Free 1X1 Trading session<br /> 3 Secured Trades")
                                <i class="fa fa-check" aria-hidden="true"></i>
                            </span>
                        </span>
                    </label>
                    <label class="btn btn-primary">
                        <span class="wrp-text">
                            <span class="title">
                                <b>@Html.RadioButtonFor(a => a.Amount, 300, new { @type = "radio" }) @AmountAndConversion(300)</b>
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - bonus", false, "BONUS")
                            </span>
                            <span class="h6">@WebContent.Get("Self Deposit", "dbns500 - deposit - 500", false, "On a $500 deposit")</span>
                            <i class="fa fa-plus-circle" aria-hidden="true"></i>
                            <span class="h5">
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - FreeBook", false, "A Free ebook")<br />
                                @WebContent.Get("Self Deposit", "dbns500 - deposit - Free1X1", false, "Free 1X1 Trading session<br /> 3 Secured Trades")
                                <i class="fa fa-check" aria-hidden="true"></i>
                            </span>
                        </span>
                    </label>
                </div>
            </div>
        </div>
    </div>
}

And for some reason the radio buttons are not being checked - it stays on the default one that is checked. Any reason?

Mohammad Akbari
  • 4,486
  • 6
  • 43
  • 74
Igal C
  • 45
  • 1
  • 9
  • 1
    What do you mean _the default one_? And its the value of `Amount` which determines which button is selected (and remove your pointless `new { @type = "radio" }` and `new { @checked = "checked" }` code) –  Apr 10 '17 at 11:02
  • @IgalC The question should be clear and more descriptive. What is your query exactly? – Kumar_Vikas Apr 10 '17 at 11:08
  • Possible duplicate of [how to select a radio button by default - asp.net mvc strongly typed html helpers](http://stackoverflow.com/questions/3149390/how-to-select-a-radio-button-by-default-asp-net-mvc-strongly-typed-html-helper) – Liam Apr 11 '17 at 07:39
  • Just set `Amount` to whatever one you want checked is the easiest way. – Liam Apr 11 '17 at 07:41

0 Answers0