Reputation: 565
I have a listview of categories with checkboxes (categories filter). But I have made a custom checkBoxes (linkButton with css is my checkBox).
<asp:LinkButton CssClass="checkBox" runat="server">
.checkbox {background: url('/style/images/checkbox.png') no-repeat top left;width:9px;height:9px;text-decoration:none;
.checked {background: url('/style/images/selected_checkbox.png') no-repeat top left;}
And in jQuery in document ready on linkButton(my custom checkbox click) I change css(add checked class)
$(".filter-select .checkbox").click(function () {
if ($(this).hasClass('checked'))
$(this).removeClass('checked');
else $(this).addClass('checked');
return false;
});
Everything works just fine, but when I want to handle checked chekcboxes on listview itemCommand, the itemCommand does not fire... If I remove jquery call, everything is o.k, so I think jquery blocks or prevents itemCommand to fire on linkButton click.
But I would need to have this itemCommand call so what should I do? Should I remove/change the way I have this checkBox with jQuery. Or did I miss something... I have also try with OnClientClick="this.disabled='true';" that I have seen is some other post, but there were no results..
Upvotes: 1
Views: 498
Reputation: 565
Ok I have change my approch and remove the jQuery thinkg... I have put everything in ItemCommand method, so I get the control in itemCommand like
LinkButton selected = e.Item.FindControl("id") as LinkButton;
Then I check the classes like:
selected.CssClass = (selected.CssClass != "checkbox checked") ? "checkbox checked" : "checkbox";
And than I check for all the checked linkButtons(custom checkBoxes)
So no jQuery interupt needed. Thanks for help
Upvotes: 1