dimitrod
03-09-2006, 10:08 AM
I am evaluating the master pages feature of spring.web and I wrote an ascx template and an aspx page.
In the template I have 3 ContentPlaceHolders. When I run the application I get the following exception:
............
ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.]
System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length) +0
System.Web.UI.ControlCollection.CopyTo(Array array, Int32 index) +52
Spring.Web.UI.MasterPage.Initialize(Page childPage) in c:\projects\daily\Spring.Net\src\Spring\Spring.Web \Web\UI\MasterPage.cs:49
Spring.Web.UI.Page.OnInit(EventArgs e) in c:\projects\daily\Spring.Net\src\Spring\Spring.Web \Web\UI\Page.cs:209
Default.DefaultForm.OnInit(EventArgs e) in c:\Inetpub\wwwroot\Test\Default.pas:74
System.Web.UI.Control.InitRecursive(Control namingContainer) +233
System.Web.UI.Page.ProcessRequestMain() +197
............
If I delete on of the ContentPlaceholders (no matter which of them) everything works as expected. Here is the code:
Template.ascx:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<spring:Head id="head1" runat="server">
<title>TestApp</title>
<link href="<%= Page.CssRoot %>/default.css" type="text/css" rel="stylesheet" />
</spring:Head>
</head>
<body>
<form id="form" method="post" runat="server">
<div id="topHeader">
<spring:ContentPlaceHolder id="topHeader" runat="server" />
</div>
<div id="leftHeader">
<spring:ContentPlaceHolder id="leftHeader" runat="server" />
</div>
<div id="body">
<spring:ContentPlaceHolder id="body" runat="server" />
</div>
</form>
</body>
</html>
Default.aspx
<body>
<spring:Content id="topHeader" contentPlaceholderId="topHeader" runat="server">Top Header</spring:Content>
<spring:Content id="leftHeader" contentPlaceholderId="leftHeader" runat="server">Left Header</spring:Content>
<spring:Content id="body" contentPlaceholderId="body" runat="server">Body</spring:Content>
</body>
Web.xml
<?xml version="1.0" encoding="iso-8859-1" ?>
<objects xmlns="http://www.springframework.net">
<object id="standardPage" abstract="true">
<property name="MasterPageFile" value="~/Template.ascx" />
<property name="CssRoot" value="css" />
</object>
<object type="~/Default.aspx" parent="standardPage" />
</objects>
Do you have any clue why I am getting this exception?
In the template I have 3 ContentPlaceHolders. When I run the application I get the following exception:
............
ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.]
System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length) +0
System.Web.UI.ControlCollection.CopyTo(Array array, Int32 index) +52
Spring.Web.UI.MasterPage.Initialize(Page childPage) in c:\projects\daily\Spring.Net\src\Spring\Spring.Web \Web\UI\MasterPage.cs:49
Spring.Web.UI.Page.OnInit(EventArgs e) in c:\projects\daily\Spring.Net\src\Spring\Spring.Web \Web\UI\Page.cs:209
Default.DefaultForm.OnInit(EventArgs e) in c:\Inetpub\wwwroot\Test\Default.pas:74
System.Web.UI.Control.InitRecursive(Control namingContainer) +233
System.Web.UI.Page.ProcessRequestMain() +197
............
If I delete on of the ContentPlaceholders (no matter which of them) everything works as expected. Here is the code:
Template.ascx:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<spring:Head id="head1" runat="server">
<title>TestApp</title>
<link href="<%= Page.CssRoot %>/default.css" type="text/css" rel="stylesheet" />
</spring:Head>
</head>
<body>
<form id="form" method="post" runat="server">
<div id="topHeader">
<spring:ContentPlaceHolder id="topHeader" runat="server" />
</div>
<div id="leftHeader">
<spring:ContentPlaceHolder id="leftHeader" runat="server" />
</div>
<div id="body">
<spring:ContentPlaceHolder id="body" runat="server" />
</div>
</form>
</body>
</html>
Default.aspx
<body>
<spring:Content id="topHeader" contentPlaceholderId="topHeader" runat="server">Top Header</spring:Content>
<spring:Content id="leftHeader" contentPlaceholderId="leftHeader" runat="server">Left Header</spring:Content>
<spring:Content id="body" contentPlaceholderId="body" runat="server">Body</spring:Content>
</body>
Web.xml
<?xml version="1.0" encoding="iso-8859-1" ?>
<objects xmlns="http://www.springframework.net">
<object id="standardPage" abstract="true">
<property name="MasterPageFile" value="~/Template.ascx" />
<property name="CssRoot" value="css" />
</object>
<object type="~/Default.aspx" parent="standardPage" />
</objects>
Do you have any clue why I am getting this exception?