I have an gridview with with one autopostback checkbox inside one template field column, i need the autopostback to count, to validate and to sync the model in server side then cant turn off autopostback.
I cant use ajax because its a project restriction and cant do nothing about. I need freeze all page in each event fire to avoid user click on another checkbox until the previous postback complete and to avoid user fire others events between postbacks. Im sory for dont post a link to jsfiddler but cant simulate asp.net postback there. Im using the folowind jquery inside an script element, this script element is inside the header element aat top:<head id="Head2" runat="server">
<title></title>
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(':checkbox').parent().click(function (event) {
alert(event.target.id); // <<<<<< dont work if removed !!!
开发者_如何学运维$(document).find('*')
.attr('disabled', 'disabled')
.removeAttr('href')
.css('color', 'grey');
return true;
});
});
</script>
</head>
<body>
to reach make it work in right way i need put the alert commented above, this alert is useless to me and annoying to user but if removed the postback dont fire well, it look like page is reloaded and load with grid and all form clean, like if first post. Why cant remove this alert ?
Why dont you show a transparent div on the whole page untill the operatin completes and then hide it after its compelete?
$(document).ready(function () {
$(':checkbox').parent().click(function (event) {
//Show a transparent div
$("<div style='position:absolute' />")
.height($(document.body).height())
.width($(document.body).width())
.css("opacity", "0.5");
.appendTo(document.body);
});
});
Don't disable the elements, put something in front of everything, much like a "loading..." div. Hide the element when the request is finished.
精彩评论