Solved

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

Posted on 2016-09-30
2
80 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 42

Accepted Solution

by:
zephyr_hex (Megan) earned 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

776 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