tags:

views:

13

answers:

2

RB:

<input type="radio" onclick="accountShow()"  runat="server" name="GuestAccount" class="GuestAccount" value="1" />


<input type="radio" onclick="accountShow()"  runat="server" name="GuestAccount" class="GuestAccount" value="0" />

Action:

Public Function Edit(ByVal guestAccount As String) As ActionResult

However I am receiving a null value

A: 

You should not be declaring server controls there; remove the runat="server" and I think it should work. Making them ASP.NET server controls means that the actual name/id will be something different, so MVC won't find it.

Generally, you don't use server controls in MVC.

Andrew Barber
Thank you very much.
bill
A: 

You could use MVC helper methods to render your radiobutton controls in your view which should fix your issue:

<%=Html.RadioButton("GuestAccount", "0", new { @class = "GuestAccount", onclick = "AccountShow()" }) %>
<%=Html.RadioButton("GuestAccount", "1", new { @class = "GuestAccount", onclick = "AccountShow()" }) %>
Andy Rose