From the point of view of the user interface, is it better to have a RadioButton set with additional functionality that allows you to uncheck the boxes, or have a set of exclusive flags, that is, only one can be checked at a time?
Update:
I did not expect such negative answers to this. Maybe this will help if I give an example that is closer to how it is used.
I have a GridView full of data-bound data. The user has the opportunity to select one of the lines as the "main", but this is not necessary. new example:
$(":radio").click(function() {
if (this.previous) {
this.checked = false;
}
this.previous = this.checked;
});
$(":checkbox").click(function() {
$(":checkbox").not(this).prop("checked", false);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Choose a primary city and state (if applicable).<br />
<table><tr><td>
<table border="1" >
<tr><td>Primary</td><td>City</td><td>State</td></tr>
<tr><td><input type="radio" name="radio" /></td><td>Pahokee</td><td>Flordia</td></tr>
<tr><td><input type="radio" name="radio" /></td><td>Palatka</td><td>Flordia</td></tr>
<tr><td><input type="radio" name="radio" /></td><td>Palm Bay</td><td>Flordia</td></tr>
<tr><td><input type="radio" name="radio" /></td><td>Palm Beach Gardens</td><td>Flordia</td></tr></table></td><td> </td><td><table border="1" >
<tr><td>Primary</td><td>City</td><td>State</td></tr>
<tr><td><input type="checkbox" /></td><td>Pahokee</td><td>Flordia</td></tr>
<tr><td><input type="checkbox" /></td><td>Palatka</td><td>Flordia</td></tr>
<tr><td><input type="checkbox" /></td><td>Palm Bay</td><td>Flordia</td></tr>
<tr><td><input type="checkbox" /></td><td>Palm Beach Gardens</td><td>Flordia</td></tr>
</table></td><tr>
</table>
Run codeHide resultShould I include an additional control to uncheck the "main" or just expand the functionality of CheckBox or RadioButton?
, RadioButton, , ?
, , JavaScript , RadioButtons GridView - , ASP.Net GroupName.
2:
. ASP.NET AJAX extender MutuallyExclusiveCheckBox