Reputation: 8156
I have a repeater in an updatepanel, in the repeater there are several panels. The panels are different in ways, but they have one common css class, so I wire their onclick, onmouseover and onmouseout event with jQuery on the $(document).ready
But after a partial postback of the updatepanel update these wires are lost and I cant find a place to put these wires back in.
$(document).ready(function () {
$(".actionicon_normal").click(function () {
ClickActionIcon($(this));
});
$(".actionicon_normal").hover(function () {
HoverActionIcon($(this));
}, function () {
OutActionIcon($(this));
});
$(".actionicon_normal").each(function (i) {
var chk = $(this).find("input");
var backpos = $(this).css("background-position").split(" ");
if (chk.attr("checked")) {
$(this).css("background-position", backpos[0] + " -" + $(this).height() + "px");
}
});
})
as you can see I modify the background position in $(".actionicon_normal").each. I need a place to run a the same after the updatepanel is updated. I tried to experiment with .ajaxComplete, but was unable to find a proper solution.
Another way would be to wire these in the codebehind, but I cannot get a hold of all the actionicons, as the ItemDataBind only urns on first load, plus even in ItemCreated I'm not able to get a hold of all these divs having one same css class, plus there is a CheckBox in the div which I need to check for the checked value and I was not able to do that either. So if the server side is a better way, I would need a lot of help on that.
Upvotes: 0
Views: 725
Reputation: 306
This page might help: http://msdn.microsoft.com/en-us/library/bb386417.aspx
The following method is triggered by the Script manager every time the page is loaded, you are only concerned about partial postbacks so it also check this
function pageLoad(sender, args) {
if (args.get_isPartialLoad()) {
}
}
Upvotes: 1