I have a main master page named Site.master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Fancybox.SiteMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<%-- JQUERY--%>
<script src="<%= ResolveClientUrl("~/Scripts/jquery-1.7.2.js") %>" type="text/javascript">
</script>
<%-- JQUERYui --%>
<script src="<%= ResolveClientUrl("~/jquery-ui-1.8.21.custom.min.js") %>"
type="text/javascript"></script>
<link rel="stylesheet" href="<%= ResolveClientUrl("~/Styles/jquery-ui-1.8.21.custom.css") %>"
type="text/css" media="screen" />
<%-- FANCYBOX VERSION 1.3.4--%>
<script type="text/javascript" src="<%= ResolveClientUrl("~/Scripts/jquery.fancybox-1.4.3.min.js") %>">
</script>
<link rel="stylesheet" href="<%= ResolveClientUrl("~/Styles/style-fancybox-1.3.4.css") %>"
type="text/css" media="screen" />
<script type="text/javascript" >
$(document).ready(function () {
$("#LoginLightbox").fancybox({
scrolling: "no"
});
});
</script>
<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form runat="server">
<asp:ScriptManager runat="server">
</asp:ScriptManager>
<div class="page">
<div class="header">
<div class="title">
<h1>
My ASP.NET Application
</h1>
<a href="Login.aspx?iframe=true" id="LoginLightbox">PRESIONAR</a>
</div>
</div>
<div class="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>
<div class="clear">
</div>
</div>
<div class="footer">
</div>
</form>
When i click on the link Presionar a fancybox is displayed as an iframe.
This iframe is other Masterpage named litebox.master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="litebox.master.cs" Inherits="Fancybox.litebox" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
The page that uses the litebox.master is Login.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/litebox.Master" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="Fancybox.login" %>
<%@ Register TagPrefix="uc1" TagName="Login" Src="~/control/Login.ascx" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="head">
<link rel="stylesheet" href="Template/Styles/style.css" type="text/css" media="screen" />
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<uc1:Login ID="LoginControl" runat="server"></uc1:Login>
</asp:Content>
And finally the usercontrol Login.ascx is
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="login.ascx.cs" Inherits="Fancybox.control.login" %>
<div style="width:400px;height:400px;background-color:Blue">
<div style="color:White">Hola</div>
<asp:TextBox ID="txtnombre" runat="server"></asp:TextBox>
<asp:TextBox ID="txtcontrasena" runat="server"></asp:TextBox>
<asp:UpdatePanel runat="server" ID="updPanelLoginIncorrecto">
<ContentTemplate>
<asp:CustomValidator ForeColor="Red" OnServerValidate="usuarioExistente_Validation"
Display="Static" Font-Size="Small" runat="server" ID="vldLogin" ValidationGroup="grupoValidacionLoginUsuario"
Text="HEYYY">
</asp:CustomValidator>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnregistro" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="btnregistro" runat="server" onclick="btnregistro_Click" ValidationGroup="grupoValidacionLoginUsuario"/>
</div>
When i press the button btnregistro for the first time it works great and if the page is invalid displays heyyy as says in the custom validator. The problem is when i press the button the following times, it breaks
The firefox console throws me this error
Timestamp: 08/08/2012 18:15:42
Error: Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: the state information is invalid for this page and might be corrupted.
Source File: http://localhost:6037/Scripts/jquery-1.7.2.js
Line: 2121
The line where it breaks jquery is
jQuery.dequeue( elem, type );
Please help me out! I have been fighting with this error for weeks and i dont know what else to do, i did google a lot but did not find any solution!!!
After weeks of trying, i tried putting type:”iframe” and magically it worked! I have no idea what has to do but now it works 🙂 So the code would be: