0

enter image description here

This is the code for retrieving the Question and options dynamically from SharePoint list. How to get the value of selected radio buttons and store it to a variable using the C# or SP code. Can anyone please help me with this?

Thanks in advance.

5
  • first check if RadioButton1.Checked is true and then use RadioButton1.Text to get its value...same for other 3 radio buttons. Refer this for more docs.microsoft.com/en-us/dotnet/api/…
    – Anil Pal
    Dec 11, 2019 at 5:46
  • RadioButton1.Checked is not itentified by the intellisence and getting an error. Can you please tell me where is the mistake. Dec 11, 2019 at 5:55
  • test once writing directly in control <asp:RadioButton id="Radio1" Text="Typical" Checked="True" GroupName="RadioGroup1" runat="server" />
    – Anil Pal
    Dec 11, 2019 at 5:58
  • Yes have added the line directly. Even after this Radio1 is not recognized by intellisense. Is it because of the repeater and it's ID? Because I'm able to fetch the ID of the repeater. But unable to proceed with this ID. Dec 11, 2019 at 6:04
  • I don't think Repeater causing any issue...I have tested with it its working...Could you please paste code instead img so I can test it too.
    – Anil Pal
    Dec 11, 2019 at 6:12

1 Answer 1

1

Try below

RadioButton rb = (RadioButton)(repeater.FindControl("RadioButton1"));
2
  • Thankyou. It is working with this: var rb1=item.FindControl("RadioButton1") as RadioButton; Dec 11, 2019 at 8:49
  • Glad it helped 😀 Dec 11, 2019 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.