TokenNotUniqueException: Token is not unique

  1. #1

    TokenNotUniqueException: Token is not unique

    Hi,

    with new version of ext.net (Ext.NET.WebForms.Pro.2.1.1) when i add a module to desktop at runtime i've this error:

    [TokenNotUniqueException: Token is not unique
    -------------------
    ID = ctl26_ClientInit
    TagName = anchor
    Match = <#:anchor id="ctl26_ClientInit" />
    ]
       Transformer.NET.Token.ParseAnchors() +532
       Transformer.NET.TextTransformer.Parse(List`1 tokensType, Dictionary`2 variables) +1088
       Transformer.NET.TextTransformer.Transform(List`1 tokensType, Dictionary`2 variables) +42
       Transformer.NET.TextTransformer.Transform(List`1 tokensType) +40
       Transformer.NET.TextTransformer.Transform() +56
       Ext.Net.ExtNetTransformer.Transform(String text) +213
       Ext.Net.InitScriptFilter.Transform() +52
       Ext.Net.InitScriptFilter.Flush() +79
       System.Web.HttpWriter.Filter(Boolean finalFiltering) +8797420
       System.Web.HttpResponse.FilterOutput() +119
       System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +52
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

    the web.config is configured with clientIDMode="AutoID", Target Framework = 4.0

    Note: with the previous version works fine (Ext.net v 2.0.0)

    Thanks,
    Valeriano
    Last edited by Daniil; Dec 27, 2012 at 11:08 AM. Reason: Please use [CODE] tags
  2. #2
    It means that control with ID=ctl26 is added several times, like
    Button b = new Button();
    Panel1.Buttons.Add(b);
    Panel2.Buttons.Add(b);
  3. #3
    In any case, it would be best if you can provide simple test case
  4. #4
    Quote Originally Posted by Vladimir View Post
    In any case, it would be best if you can provide simple test case
    Simplified version of the code

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Desktop.aspx.vb" Inherits="WebApplication1.Desktop" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Desktop ID="desktop" runat="server">
            <StartMenu ID="startmenu_desktop">
                <ToolConfig>
                    <ext:Toolbar ID="startmenu_toolbar" runat="server" >
                        <Items>
                            <ext:Button ID="btn_logout" runat="server" Icon="DoorOut" />
                        </Items>
                    </ext:Toolbar>
                </ToolConfig>
            </StartMenu>
            <TaskBar TrayWidth="100">
                <Tray>
                    <ext:Toolbar ID="tray_toolbar" runat="server">
                        <Items>
                            <ext:Button ID="btn_language" runat="server" MenuArrow="false" Cls="x-bold-text" MenuAlign="br-tr">
                                <Menu>
                                    <ext:Menu ID="mnu_language" runat="server" />
                                </Menu>
                            </ext:Button>
                            <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                        </Items>
                    </ext:Toolbar>
                </Tray>
            </TaskBar>
        </ext:Desktop>
        </form>
    </body>
    </html>
    Public Class Desktop
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            Dim module_entities As WebUserControl1 = CType(Me.LoadControl("~/WebUserControl1.ascx"), WebUserControl1)
            Dim desktop_module As Ext.Net.DesktopModuleProxy = Ext.Net.Utilities.ControlUtils.FindControl(Of Ext.Net.DesktopModuleProxy)(module_entities)
            desktop.Modules.Add(desktop_module.Module)
    
        End Sub
    
    End Class
    <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="WebUserControl1.ascx.vb" Inherits="WebApplication1.WebUserControl1" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <ext:DesktopModuleProxy ID="DesktopModuleProxy1"  runat="server">
        <Module ModuleID="Module1">
            <Window>
                <ext:Window runat="server" ID="Window1"></ext:Window>
            </Window>
        </Module>
    </ext:DesktopModuleProxy>
  5. #5
    Thanks for the sample, we are investigating
  6. #6
    ok,
    thank you

    Valeriano
  7. #7
    At this moment, I can suggest to remove
    desktop.Modules.Add(desktop_module.Module)
    It should work for initial page load request
  8. #8
    Another option, add for PreventAdding=true DesktopModuleProxy
    In this case, the module will not be registered automatically and you need to add it to desktop modules manually
  9. #9
    both solutions work fine.

    thank you,
    Valeriano

Similar Threads

  1. [CLOSED] Token is not unique
    By SFritsche in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 04, 2013, 8:08 AM
  2. Replies: 3
    Last Post: Apr 16, 2012, 1:56 PM
  3. [CLOSED] Load failed: Unexpected token <
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 02, 2010, 5:58 PM
  4. Replies: 1
    Last Post: Jan 27, 2010, 12:19 PM

Posting Permissions