Html.RadioButton sets all values to selected value after postback?

When using the Html.RadioButton() html helper with a value field that is an Enum to ModelBind() to, once you have chosen a value all the radio buttons of that name group are set to the chosen value instead of the value you gave it thereby making it impossible to select a different value.

Related stackoverflow question: http://stackoverflow.com/questions/277607/htmlradiobutton-sets-all-values-to-selected-value
0
Boris2
11/10/2008 11:02:26 AM
asp.net.mvc 4300 articles. 0 followers. Follow

3 Replies
1602 Views

Similar Articles

[PageSpeed] 13

Hi

Thank you for reporting this. We are aware of this problem in the Beta release and have already filed a bug for this on our end.

Thanks,

Jacques

0
jeloff
11/10/2008 4:20:08 PM

I wrote a full explanation of this bug and how you can overcome it until the next MVC release. Refer to this link: http://forums.asp.net/t/1338576.aspx

0
sia123
11/10/2008 11:38:44 PM
Thanks for the response. I'll be looking out for the next drop then and in the meanwhile have a look at the workaround you linked me.
0
Boris2
11/12/2008 7:50:28 AM
Reply:

Similar Artilces:

HTML.select (UI helper) how to build a select list with value not equal to the display value
Hi Guys, I have a newbie question on HTML.select (UI helper). One of the tutorial I have come across shows the following: "string [] SelectList = new string[]{'Apple', 'Orange','Mango','Banana'};" "Html.Select('FruitList',SelectList)" it will give me:value = "Apple"  "Apple " However, I would like to have the following instead: value = "1"  "Apple " What should I do on the VIEW in order to achieve this? thx, George what you need to do is create a collection to use for your data sou...

Dropdownlist selected value passes first value in list no matter what value is selected. why ?
 HI . I have a dropdownlist. Databinds ok but when I must pass a value as a Selected value it always passes the first value in the list even if I select another value. I tried to set the ddl to enableviewstate false but it doesn't change anything. Any ideas ? Code below, thanksLoading the ddl:       productCategories = CatalogAdmin.Admin_Product_Categories_NotIn(productId);        for (int i = 0; i < productCategories.Rows.Count; i++)        {       &...

Setting a label value to a dropdownlist selected value
I am trying to set the value of a label to the selected value from a hidden dropdown list. This code is not working and the label value remians at its default. Any ideas? Thanks very much. Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Dim mylabel As Label Dim myddl As DropDownList If (DetailsView1.CurrentMode = DetailsViewMode.ReadOnly) Then mylabel = DetailsView1.FindControl("Label1") myddl = DetailsView1.FindControl("DropDownListViewOffice") mylabel.Text = myddl.SelectedValue.ToString End If I have now put this code in the Page_Load su...

Based on selected value from HTML.Dropdownlist, the values to be fetched
Hi,  I'm using Html.DropDownList.  When selection within this box changes, I need to retrieve the values from table based on the selected id(datavaluefield) of dropdownlist. Here my code ViewPost.cs viewpage <%=Html.DropDownList("CategoryID",ViewData["CategoryID"])%>  ---- based on selected value from the user the below table should fetch the value the db <table>        <tr>                   ...

How to set selected value in drop down based on query value
i have a dropdownlist populated with values frm database   when i want to view or edit a particular record i populated the textbox with the needed record details same way i wan the dropdown to display the selected value as the first index received frm the query  If you palced it inside a data control , then you can bind it's selected value with a database field like this :<asp:DropDownList id=...  SelectedVale='<%# Eval("DataBaseField") %>'  .... Regards,Anas Ghanem.Note:Please Don't hesitate to click "Report Abuse" ...

cascading dropdown set it's value only once but not on subsequent postbacks,web service recieve the value but can't set in dropdown
i have a dropdown named uxcommunity which is a dropdown and contain text in format ##-####-#### . and 2 more dropdowns province and district where province filters district. i get the first 2 characters ##  for session("province") and #### for session("District") and i have button to do the postback. first when the form loads and i click the button it get the value and select appropraite items in to dropdown province and district. but when i change the province dropdown content and district dropdown content and click the button , session will take correct...

Setting Selected RadioButton From Database Value
I'm having trouble assigning which one of three radiobuttons in a group is checked depending on the value received from a database. I have a form which is used for editing details of users os a site. The form is filled each time the OnSelectedIndexChanged method of a dropdownlist to trigger a sub routine. As part of that routine a database is queried and various values are retreived. One of these is the level of access that the user is permitted. This is stored as an integer where 1=manager, 2=standard user and 3=read only. On my form I have three radiobuttons marked as Manager, Sta...

If Not value or value then....
Hi all,I want to write a simple IF Not then statement in ASP.net 2.0 and I would like some help please.  If Not ntuser = "DOMAIN\ntuser" Or ntuser = "DOMAIN\ntuser2" Then Panel1.Visible = False End If Doesnt work, can you tell me where i'm going wrong please?many thanks.  The first place you're going wrong is in telling us it "doesn't work" without providing any details. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue. Use Not as stated below. It ...

to change value of Client Side Select html control from database value....
hello forum,  I have a select .. Demo.aspx <select id="DropAccType" name="DropAccType"> <option>Select</option> <option>Saving</option> <option >Current</option> <option>Regular</option> <option>Demat</option> </select> I want to set the value of select by fetching the data from daabase i.e. In my table if I have Value current then when i request the demo.aspx then in select Control the value Current should get selected..... Please help me to sort this out...   Thnx in advance.. Hi-I could be...

setting radiobutton selected value on row edit
I have a gridview with a radiobutton list.  On databound, I pull the data from the database and select the correct value in the radiobutton list. but if it changes, I place the row in edit mode because they may have to enter more information.  The problem I am having right now is the radiobutton is losing its selected value.  Here is the code.  Any suggestions would be welcome.Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) ' get sender (the RadioButtonList) Dim RBL As RadioButtonList = TryCast(sender, RadioButtonLis...

get value from <select> value & display value
hi all, i want these two bold values which are below,  underline value i can get but second bold value i m not avail to get please help.... <select><option value="ma">manoj</option> </select> regard khushak  P.S. if possible then Please with  java script other wise code behind New In .NET World See my post in this thread.  That should take care of you. Peter BrunoneMS MVP, ASP.NETFounder, EasyListBox.comDo the impossible, and go home early....

Set radiobutton selected value based on database result?
Hi all, I am using a radiobuttonlist but need to set the checked value based on the value i get from the database. Basically i am updating a record stored in my database and need to set the checked value to the one originally entered by the user. I have posted the code below and would appreciate any help on this. <asp:RadioButtonList ID="RadioButtonList1" runat="server"><asp:ListItem Value="1">Yes</asp:ListItem> <asp:ListItem Selected="True" Value="0">No</asp:ListItem></asp:RadioButtonList> -----------...

Cascading Dropdown - Initially selected value
Hi there, I am having an issue with a pretty basic problem. I have managed to get the cascading drop down lists working ok with information coming from a database. On the initial page, I need to have a value in the drop down list already selected, i.e. the current year in one drop down and current month in the next. The information from both of these is sent to a query to output a datatable. Can anyone help with this? I'm not sure I understand the scenario, but I think the new CascadingDropDownNameValue(..., defaultValue) constructor may be just what you're looking for. (First available ...

Selected value in select list with javascript based off value in database
 I've got a classic asp page with a select list. I need the select list's selected value to be whatever the user selected when they created their account. I've been trying to use <body onLoad="onLoad();"> to call my function, and then I'm trying to specify which value should be selected in the function. Also, when the select list selected values change, there is a javascript function I call to disable text boxes. I think there is an issue with my javascript function, and I can't find any examples of this from good ole' google.  My j...

Web resources about - Html.RadioButton sets all values to selected value after postback? - asp.net.mvc

'android-widget' tag wiki - Stack Overflow
Q&A for professional and enthusiast programmers

dBase - Wikipedia, the free encyclopedia
dBase II was the first widely used database management system (DBMS) for microcomputers . It is a relational database management system. It was ...

Perl/Tk Menus: Past, Present and Future - The Perl Journal, Summer 1999
Whether they drop down as rectangles or pop up as pies, menus are widgets that managebundles of related information. Menus are pervasive, appearing ...

Index - 2,000 Things You Should Know About WPF
Below is a list of all posts created so far for the 2,000 Things You Should Know About WPF blog. Total number of posts = 1,077 Animation #7 - ...

Moonify UI - 365psd
Join our growing community of Photoshop users. Sign Up or Log In 365psd Download a free psd every day. Collections Contributors Premium Files ...

Learning Mobile Development - Android and iOS Lessons For Beginners
... Android and iOS Lessons For Beginners Menu Skip to content Home Android Tutorials IOS Tutorials Contact us Search for: Customize RadioButton ...

Basic4android (Basic for Android) - Android programming with Gui designer
Basic4android (Basic for Android) is a simple and powerful development environment for developers of Android applications.

Bravenet Webmaster Resource Center - Scripts, sounds, art and more
Cheap web hosting and free web tools. Build your website with our easy webpage builder, web tools, web services, and free website content.

Gchat - Home
Gchat - is easy to use program, suitable for communicating with friends. This non-commercial program that you can change it as you like. Program ...

Microsoft readies Silverlight 2 beta
Featured in Version 2 is a cross-platform, cross-browser version of the .Net Framework, a Microsoft official said.

Resources last updated: 12/20/2015 2:35:07 AM