Uncheck radio button custom control in ASP MVC - asp.net-mvc-3

I want to create a radio button custom control in my ASP MVC application. I am using HTML Helpers for this (I hope it is the right way). I want to know if there is a way to make the radio button unchecked when clicked.
Any ideas ?
Thanks

I want to know if there is a way to make the radio button unchecked when clicked.
That's a very weird requirement and you probably should be using checkboxes instead of radio buttons, but anyway, it is possible with javascript. If we suppose that the radio button is checked initially and you want to uncheck it when clicked:
$(function() {
$('#id_of_radio_button').click(function() {
$(this).removeAttr('checked');
});
});
But really, that's very weird. Radio buttons normally work by having them in groups: you have a couple of radio buttons and you can check only one in the group. So by selecting a different radio button in the group you are unchecking the current one.
Checkboxes on the other hand are not grouped. You can check/uncheck their values by clicking on them.

Related

Multiselect option with remove item

I'm looking for a Qt/QML multiselect control that have a remove button.
I want to add a filter builder and I didn't find a good example or control for this purpose.
I can design token by myself. I'm just curious if someone already did that and can share it.
Multi filter selector
Thanks
A simple radio button for each option can do the job. If you do not include all these radio buttons under an exclusive group, a second click on these buttons deselects the option.
A click on the radio button includes selected option in the search results and second selection removes the option from the results.
An extra button which deselects all the radio buttons can also be added.
I don't intend to insult or disrespect you, but i think with radio buttons the task takes less time than posting this question.

Disable 'Warning Dialog' in jqgrid Edit/Delete

I'm using jqgrid inline edit in my application which is also accessed in mobile. Since the user access space in the mobile is small i dont want the pop-up's throwing in the middle.
So, basically when the user did not select the row and click the edit/delete button the warning dialog is thrown "Please, select a row". Now i did not want the alert. Just when the user click on the edit/delete button without selecting the row it should stand still. Nothing happens.
Is this possible? How can i achieve this?
I would suggest you another way. One can disable or hide Delete/Edit buttons until a row will be selected. Inside of loadComplete one should test whether any row is selected (it could be selected if you use reloadGrid with {current:true} option for example). In the case you can disable or hide Delete/Edit buttons once more.
The demo created for the old answer shows how to disable navigator buttons by adding ui-state-disabled class. Another demo created for the answer demonstrates in interactive form how to show/hide navigator buttons.

Make one button enable a different button

I have 4 custom radio buttons that change a message when clicked. The message deals with search terms. I have one search button. Does anyone know of a way to make the search button activate a different action to take you to a different page depending on which of the radio buttons is clicked?
Kind of like having one search button hooked up to 4 different actions and enable/disable the actions from the radio buttons.
If any on knows how to do this with just 2 buttons, then I can figure out the logic for 4 buttons.
Here is my new working code:
//Search Button
-(IBAction)showWineriesButton
{
btnSearchWineries.hidden=FALSE;
btnSearchGrapes.hidden=TRUE;
btnSearchWines.hidden=TRUE;
btnSearchReviews.hidden=TRUE;
}
-(IBAction)showGrapesButton
{
btnSearchWineries.hidden=TRUE;
btnSearchGrapes.hidden=FALSE;
btnSearchWines.hidden=TRUE;
btnSearchReviews.hidden=TRUE;
}
-(IBAction)showWinesButton
{
btnSearchWineries.hidden=TRUE;
btnSearchGrapes.hidden=TRUE;
btnSearchWines.hidden=FALSE;
btnSearchReviews.hidden=TRUE;
}
-(IBAction)showReviewsButton
{
btnSearchWineries.hidden=TRUE;
btnSearchGrapes.hidden=TRUE;
btnSearchWines.hidden=TRUE;
btnSearchReviews.hidden=FALSE;
}˚

in a jqgrid editform, i need to restrict checkbox selection to only one at a time

i have a jqgrid editform with three checkboxes. I need the checkboxes to function like typical html Radio buttons that let a user select ONLY ONE of a limited number of choices.
Unfortunately, jqgrid does not offer radio button editypes.
I know that i can setup an event to deselect all other checkboxes in the editform. Is this the only way to do it in jqgrid?
You can bind the click event to any from the checkboxes and in the event handler to uncheck all other chechboxes in the form if the current checkbox will be checked.

GUI: radio button group without selection?

Image a couple of objects for which one property can have 3 possible values. To edit them I want to use a radio button group with 3 buttons. If you have one object selected, it's obvious which radio button to select. But which what to select if multiple objects with different values of this property are selected? A radio button group without a selected radio button looks somewhat "naked".
One possible solution would be to add a 4th button to the group that indicates that the property is not set. You could have that one be the default when you need an 'indeterminate' default setting. This would allow the radio button group to start out with a selected radio button.
That being said, I'm having a hard time visualizing your situation. Do you think you could add some more detail to your question? I think you are talking about the default state of the radio buttons, but I'm not totally sure.
Hope this helps.

Resources