Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

radio button not updated after make change asp.net c#

Posted on 2016-09-30
2
Medium Priority
?
174 Views
Last Modified: 2016-10-03
I have this set of buttons in asp.net c# webapp:

                <asp:TableCell ID="TableCell8" runat="server" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"><center><asp:RadioButton id="a1a" Text="" Checked="True" GroupName="pra1" runat="server"/></asp:TableCell>

				<asp:TableCell ID="TableCell11" runat="server" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"><center><asp:RadioButton id="a1b" Text="" Checked="False" GroupName="pra1" runat="server"/></asp:TableCell>

				<asp:TableCell ID="TableCell14" runat="server" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"><center><asp:RadioButton id="a1c" Text="" Checked="False" GroupName="pra1" runat="server"/></center></asp:TableCell>  

Open in new window


Now via the page load in asp,net c# we make changes to text boxes and radio buttons and then the user is control after that to make new changes.

However when the user submit a new change that changes are not stored and we know that issue happens for the post back issue. Now for text boxes we solved with a command like this: "Request.Form[a1a.ClientID]". That worked perfect for text boxes but for radio buttons we don't know how.  What can we do for radio buttons? or is there ipa a similar command like "Request.Form[a1a.ClientID]" but for radio buttons? What we want to check is the new status if true or false of the radio button of the new user selection but i. code behind and after a change store. Like I mentioned before we had the same problem with text boxes and we solved just storing the value of "Request.Form[a1a.ClientID]" and simply like that we don't if there is a similar command for radio buttons.

Thank you
0
Comment
Question by:Alex E.
2 Comments
 
LVL 44

Accepted Solution

by:
zephyr_hex (Megan) earned 2000 total points
ID: 41826789
You can get the selected state of a radio control from code behind doing:
a1a.Checked

Open in new window


It will return true or false.

If you have a reason to reference Request.Form instead of the control itself, you can do:
Request.Form[a1a.UniqueID])

Open in new window


Please note:  ClientID is the id on the client side (so, for example, if you need to reference the control from JavaScript).  You want UniqueID to reference a control on server side.
0
 

Author Closing Comment

by:Alex E.
ID: 41826927
Thank you
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question