May 03, 2012, 12:39 PM
[CLOSED] Keep receiving the following exception "An item with the same key has already been added."
Hello,
When using the following example, I keep receiving the following exception:
Layout.cshtml:
Can this be looked at? I'm using DP1.
Cheers,
Timothy
When using the following example, I keep receiving the following exception:
An item with the same key has already been added.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: An item with the same key has already been added.
Source Error:
Line 80: new public static string Transform(string text)
Line 81: {
Line 82: return new ExtNetTransformer(ExtNetTransformer.PrepareText(text)).Transform();
Line 83: }
Line 84:
Source File: D:\Application\Library\Required Dependencies\Ext.NET\Source\2.0.0.DP1\Ext.Net\Core\ExtNetTransformer.cs Line: 82
Stack Trace:
[ArgumentException: An item with the same key has already been added.]
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +12674096
Transformer.NET.Token.ParseAnchors() +478
Transformer.NET.TextTransformer.Parse(List`1 tokensType, Dictionary`2 variables) +793
Transformer.NET.TextTransformer.Transform(List`1 tokensType, Dictionary`2 variables) +22
Ext.Net.ExtNetTransformer.Transform(String text) in D:\Application\Library\Required Dependencies\Ext.NET\Source\2.0.0.DP1\Ext.Net\Core\ExtNetTransformer.cs:82
Ext.Net.InitScriptFilter.Transform() in D:\Application\Library\Required Dependencies\Ext.NET\Source\2.0.0.DP1\Ext.Net\Core\InitScriptFilter.cs:70
Ext.Net.InitScriptFilter.Flush() in D:\Application\Library\Required Dependencies\Ext.NET\Source\2.0.0.DP1\Ext.Net\Core\InitScriptFilter.cs:57
System.Web.HttpWriter.Filter(Boolean finalFiltering) +398
System.Web.HttpResponse.FilterOutput() +141
System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +168
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
When using the following:Layout.cshtml:
<!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 runat="server">
<title>@ViewBag.Title</title>
</head>
<body>
@(Html.X().ResourceManager()
.IDMode(Ext.Net.IDMode.Static)
.Theme(Ext.Net.Theme.Gray)
)
@(Html.X().Viewport()
.Border(false)
.Layout(Ext.Net.LayoutType.Fit)
.Items(a =>
a.Add(Html.X().Panel()
.BodyStyle("background-color: #FFFFFF;")
.Border(false)
.Layout(Ext.Net.LayoutType.Border)
.Items(b =>
{
b.Add(Html.X().Panel()
.BodyCls("x-panel-fade")
.Border(false)
.ItemsFromSection(this, "Content")
.Region(Ext.Net.Region.Center)
);
} )
)
)
)
</body>
</html>
Index.cshtml:@{
ViewBag.Title = "Title";
Layout = "~/Areas/Management/Views/Shared/Layout.cshtml";
}
@section Content {
@(Html.X().Panel()
.Border(false)
.Padding(15)
.Items(a =>
{
a.Add(Html.X().Container()
.Html(@"
<h1>Setup</h1>
<p>Welcome to the Setup</p>
<br>
")
);
} )
)
}
It will only work when I change it to the following: a.Add(Html.X().Container()
.ID("Welcome")
.Html(@"
<h1>Setup</h1>
<p>Welcome to the Setup</p>
<br>
")
);
I don't want to have to define an ID for everything :(Can this be looked at? I'm using DP1.
Cheers,
Timothy
Last edited by Daniil; May 03, 2012 at 3:14 PM.
Reason: [CLOSED]