问题
I am using the FancyBox jQuery plugin (http://fancybox.net/) in my ASP.NET website and have hit a small but annoying issue.
The site uses the default ASP.NET login controls and then displays some links which pop open a form in a FancyBox - all this works great. If I do not click any of the FancyBox links and then hit the logout link (provided by the LoginStatus control) again everything works as it should.
However if I click on one of the FancyBox links and then close it the logout link no longer works, nothing happens at all - it would appear as if the postback is not firing for some reason.
I have done some searching but not come across anyone with a similar issue - has anyone seen this issue before?
Thanks in advance
UPDATE: With a little help from IE debugger I have tracked the problem down to a JavaScript error here -
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
More specifically on the line that sets the eventtarget and the error I recieve is -
SCRIPT5007: Unable to set value of the property 'value': object is null or undefined
UPDATE 2: I have put a temporary fix in place - basically I just hook into the onClosed event and reload the page at that point -
$("#form_popup").fancybox({
'scrolling': 'no',
'titleShow': true,
'onClosed' : function() {
location.reload();
} });
Of course the problem is the page will be fully reloaded from scratch missing the point of using jQuery but at least it works!
回答1:
For anyone who has the same problem I fixed this with this hack
$("#form_popup").fancybox({
'scrolling': 'no',
'titleShow': true,
'onClosed' : function() {
location.reload();
} });
So the page gets reloaded whenever the close button is pushed which fixes the problem.
来源:https://stackoverflow.com/questions/9157976/jquery-fancybox-stopping-asp-net-logout-link-from-working