Avatar of Andy Green
Andy Green
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Untick checkboxes within a span of same name


I have a set of checkboxes (within a grid item template), and because of the way the page is I can't use a radio button.

I want to be able to only have ticked at a time.

So far I have added a class - chkPri.Attributes.Add("class", [String].Format("diags"))

and tried this jQuery - $('input.diags').not(this).prop('checked', false);

but the page is being rendered with the input inside a span with the class added to the span.

<span class="diags">

<input name="rpbOutcomes$i1$rgProcedures$ctl00$ctl07$chkPrimary" id="rpbOutcomes_i1_rgProcedures_ctl00_ctl07_chkPrimary" onclick="setDiags(this);" type="checkbox">


I have tried using inutAttribute but this wasn't being rendered.

I have also tried $("span[class='diags']").not(this).prop('checked', false); this finds the span but not the checkbox inside it.

Can anyone point me in the right direction.

Simply put I only want one checkbox to be ticked. The checkboxes are inside a grid.


Avatar of undefined
Last Comment
Andy Green

8/22/2022 - Mon

Are these the only checkboxes on the whole page? Can you provide a rendered page in html code?
Andy Green

No I have 3 groups of checkboxes, its only these 1 set I want to control like this.

In the itemdatabound I'm adding the chkPri.Attributes.Add("class", [String].Format("diags")) so only this 1 set have the diag class attribute.

This is the html for the section:

<table class="rgMasterTable" id="rpbOutcomes_i1_rgProcedures_ctl00" style="width: 100%; table-layout: auto; empty-cells: show;" border="0">
		<col style="width: 20px;">
		<col style="display: none;">
		<col style="width: 65px;">
			<th class="rgHeader rgGroupCol" scope="col">&nbsp;</th><th class="rgHeader" style="display: none;" scope="col">&nbsp;</th><th class="rgHeader" scope="col">Description</th><th class="rgHeader" style="text-align: center;" scope="col">Code</th><th class="rgHeader" style="text-align: center;" scope="col">&nbsp;</th>
	<tr class="rgGroupHeader">
		<td class="rgGroupCol"><input name="rpbOutcomes$i1$rgProcedures$ctl00$ctl04$ctl00" class="rgCollapse" id="rpbOutcomes_i1_rgProcedures_ctl00__2__0" onclick="javascript:__doPostBack('rpbOutcomes$i1$rgProcedures$ctl00$ctl04$ctl00','')" type="button" value=" "></td><td colspan="3"><p>Diagnosis Codes</p></td>
	</tr><tr class="rgRow" id="rpbOutcomes_i1_rgProcedures_ctl00__0" style="background-color: rgb(255, 214, 102);">
		<td class="rgGroupCol">&nbsp;</td><td style="display: none;">624</td><td valign="top">Diag 002</td><td align="center" valign="top">D002</td><td align="center">
                                                                            <span class="diags"><input name="rpbOutcomes$i1$rgProcedures$ctl00$ctl05$chkPrimary" id="rpbOutcomes_i1_rgProcedures_ctl00_ctl05_chkPrimary" onclick="setDiags(this);" type="checkbox"></span>
	</tr><tr class="rgAltRow" id="rpbOutcomes_i1_rgProcedures_ctl00__1">
		<td class="rgGroupCol">&nbsp;</td><td style="display: none;">622</td><td valign="top">Diagnotic 001</td><td align="center" valign="top">DIA001</td><td align="center">
                                                                            <span class="diags"><input name="rpbOutcomes$i1$rgProcedures$ctl00$ctl07$chkPrimary" id="rpbOutcomes_i1_rgProcedures_ctl00_ctl07_chkPrimary" onclick="setDiags(this);" type="checkbox"></span>
	</tr><tr class="rgGroupHeader">
		<td class="rgGroupCol"><input name="rpbOutcomes$i1$rgProcedures$ctl00$ctl09$ctl00" class="rgExpand" id="rpbOutcomes_i1_rgProcedures_ctl00__7__0" onclick="javascript:__doPostBack('rpbOutcomes$i1$rgProcedures$ctl00$ctl09$ctl00','')" type="button" value=" "></td><td colspan="3"><p>Investigation Codes</p></td>
	</tr><tr class="rgGroupHeader">
		<td class="rgGroupCol"><input name="rpbOutcomes$i1$rgProcedures$ctl00$ctl12$ctl00" class="rgExpand" id="rpbOutcomes_i1_rgProcedures_ctl00__10__0" onclick="javascript:__doPostBack('rpbOutcomes$i1$rgProcedures$ctl00$ctl12$ctl00','')" type="button" value=" "></td><td colspan="3"><p>Treatment Codes</p></td>


Open in new window

Don't think is has copied everything  View source doesn't capure everything, this was taken from IE developer tools, but it too has missed some stuff.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Andy Green

Excellent, thank you.

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.