Select radio button from RadioButtonList with URL - asp.net

I have a web form with a dynamically created RadioButtonList, a topic text box, a message text box, and a submit button. I need my monitoring from Solarwinds to be able to submit the form using the post method. I'm using QueryString for the text boxes, but I'm lost with the radio buttons. Is there a way to select a radio button via the URL and submit the form? Here is a sample of the generated HTML:
<input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="value 1" /><label for="RadioButtonList1_0">Topic 1</label>
<input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="value 2" /><label for="RadioButtonList1_1">Topic 2</label>

This is all I needed. Having a slow day today!
RadioButtonList1.SelectedValue = Request.QueryString["selected"];
www.myurl.com?selected=value 1

Related

Bootstrap Toggle with ASP.NET

I'm using bootstrap-toggle in one of the forms in ASP.NET:
<input type="checkbox" id="IsValidated" data-toggle="toggle" data-on="Validated" data-off="Not Validated" data-onstyle="success" data-offstyle="danger" value="Y" >
But when switching on the toggle, and check the state of the checkbox in the code behind after posting the form, always I find that the checkbox is not checked!
How to capture the state of the checkbox?
Add name attribute to your checkbox element
<input type="checkbox" name="IsValidated" id="IsValidated" data-toggle="toggle" data-on="Validated" data-off="Not Validated" data-onstyle="success" data-offstyle="danger" value="Y" >
Access the checkbox value on server side using
Request.Form["IsValidated"]

How to Remove character-counter in radio button in materializecss

I need to remove this span tag its come automatically when i click on radio button
I think you used class="with-gap" in <input> like this :
<input class="with-gap" name="group3" type="radio" checked />
Remove it like this :
<input name="group3" type="radio" checked />
And your problem will be solve. Read here for more info.

Radio check/uncheck in mvc 4 razor

I'm trying to make the radio button checked based on the roleId in the ViewBag but no matter what the value is the radio button is always checked.
Here is the razor :
<input type="radio" id="rdResident" class="userType" checked="#(ViewBag.roleId=="5"?"checked":"false")" />
All you need the word "checked". Try...
<input type="radio" id="rdResident" class="userType" #(ViewBag.roleId==5 ? "checked" : "") />

Changing input radio into large div boxes

I'm trying to figure out how to hide the radio buttons and instead, use div boxes so users can click on a large box instead of a small button.
Is this possible?
Associate divs with a radio button via click and you're set.
<div class="radio-wrap"><input type="radio"></div>
$('div.radio-wrap').click(function(e){
$(this).find('[type=radio]').attr('checked',true);
});
You can hide the radio input with css or move it where you want.
jQuery UI provides a buttonset feature that may work:
<div id="radio" align="center" >
<input type="radio" name ="gender" id="male" value="MALE" checked="checked"/><label for="male">MALE</label>
<input type="radio" name ="gender" id="female" value="FEMALE" /><label for="female">FEMALE</label>
</div>
and script
$(function() {
$( "#radio" ).buttonset();
});
Demo

Checkbox validation for multiselection

i need to restrict users selecting check boxes multiple times, only one check box should be seleted in my asp.net form ,
i am not using a checkbox list
Please help
Use something like this:
<input type="radio" name="foo" value="bar1" id="bar1"> <label for="bar1">Bar One</label>
<input type="radio" name="foo" value="bar2" id="bar2"> <label for="bar2">Bar Two</label>
<input type="radio" name="foo" value="bar3" id="bar3"> <label for="bar3">Bar Three</label>
Use Javascript. Call a method whenever a CheckBox is clicked that takes the ID of that CheckBox as an argument and then unchecks all other Checkboxes in the given context.

Resources