[CLOSED] Gridpanel.Render error on Ext 2.1.1

  1. #1

    [CLOSED] Gridpanel.Render error on Ext 2.1.1

    Same Code in Ext 2.0 and Ext.2.1.1
    work on 2.0. error on 2.1.1 (Grid.Render (True))
    Public Class clsGridCol
        Private mCol1 As String
        Private mCol2 As String
        Public Property Col1 As String
            Get
                Return mCol1
            End Get
            Set(value As String)
                mCol1 = value
            End Set
        End Property
        Public Property Col2 As String
            Get
                Return mCol2
            End Get
            Set(value As String)
                mCol2 = value
            End Set
        End Property
    End Class
    Public Class frmGridRenderTest
        Inherits System.Web.UI.Page
    
        Private mobjLstOfGridCol As List(Of clsGridCol)
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            LoadGrid()
    
        End Sub
        Public Sub LoadGrid()
            Dim objGirdCol As clsGridCol
            Dim i As Integer
            Dim objExtCol As Ext.Net.Column
            Dim objModel As New Ext.Net.Model
    
            mobjLstOfGridCol = New List(Of clsGridCol)
            objModel.Fields.Clear()
    
            objModel.Fields.Add("Col1", Ext.Net.ModelFieldType.String)
            objModel.Fields.Add("Col2", Ext.Net.ModelFieldType.String)
            objModel.IDProperty = "Col1"
    
            For i = 1 To 10
                objGirdCol = New clsGridCol
                objGirdCol.Col1 = "Col1 - " & i
                objGirdCol.Col2 = "Col2 - " & i
                mobjLstOfGridCol.Add(objGirdCol)
            Next
            objExtCol = New Ext.Net.Column
            objExtCol.Text = "Col1"
            objExtCol.DataIndex = "Col1"
            GridPanel1.AddColumn(objExtCol)
    
            objExtCol = New Ext.Net.Column
            objExtCol.Text = "Col2"
            objExtCol.DataIndex = "Col2"
            GridPanel1.AddColumn(objExtCol)
    
    
            Store1.DataSource = mobjLstOfGridCol
            Store1.Model.Clear()
            Store1.Model.Add(objModel)
            Store1.RebuildMeta()
            Store1.DataBind()
    
            GridPanel1.Render()
    
        End Sub
    End Class
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frmGridRenderTest.aspx.vb" Inherits="prjExtNetTest.frmGridRenderTest" %>
    
    <!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">
        <div>
        
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server" Height="300" Title="Title" StoreID ="Store1"/>
           
            <ext:Store ID="Store1" runat="server">
            </ext:Store>
            <br />
        
        </div>
        </form>
    </body>
    </html>



    Token is not unique
    -------------------
    ID = \
    TagName = anchor
    Match = <#:anchor id=\"id67093eaebbc29702\" />
    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: Transformer.NET.TokenNotUniqueException: Token is not unique
    -------------------
    ID = \
    TagName = anchor
    Match = <#:anchor id=\"id67093eaebbc29702\" />


    Source Error:


    Line 68: Store1.DataBind()
    Line 69:
    Line 70: GridPanel1.Render(True)
    Line 71:
    Line 72: End Sub


    Source File: C:\TestASP\prjExtNetTest\prjExtNetTest\frmGridRend erTest.aspx.vb Line: 70

    Stack Trace:


    [TokenNotUniqueException: Token is not unique
    -------------------
    ID = \
    TagName = anchor
    Match = <#:anchor id=\"id67093eaebbc29702\" />
    ]
    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
    Transformer.NET.Html.HtmlTransformer.Transform(Str ing text) +58
    Ext.Net.DefaultScriptBuilder.Build(RenderMode mode, String element, Nullable`1 index, Boolean selfRendering, Boolean forceResources, String method, Boolean forceLazy, Boolean clearContainer) +7823
    Ext.Net.DefaultScriptBuilder.Build(RenderMode mode, String element, Nullable`1 index, Boolean selfRendering, Boolean forceResources) +73
    Ext.Net.DefaultScriptBuilder.Build(Boolean selfRendering) +82
    Ext.Net.BaseControl.ToScript(Boolean selfRendering) +94
    Ext.Net.BaseControl.Render(Boolean selfRendering) +82
    prjExtNetTest.frmGridRenderTest.LoadGrid() in C:\TestASP\prjExtNetTest\prjExtNetTest\frmGridRend erTest.aspx.vb:70
    prjExtNetTest.frmGridRenderTest.Page_Load(Object sender, EventArgs e) in C:\TestASP\prjExtNetTest\prjExtNetTest\frmGridRend erTest.aspx.vb:31
    System.Web.UI.Control.OnLoad(EventArgs e) +91
    System.Web.UI.Control.LoadRecursive() +74
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
    Last edited by Daniil; Jan 23, 2013 at 9:16 AM. Reason: [CLOSED]
  2. #2
    Hi,

    The Render method should be called only during Ext.NET AJAX request (DirectEvent or DirectMethod). It should not be called during initial Page_Load.
  3. #3
    I already try to remark .Render(), but gridpanel haven't show out.
  4. #4
    I try
    1) not all on page_load (Case 1.png)
    2) Call Render on DirectClick
    2.1. Call .Render(true) (Case 1.png)
    2.2. Call .Render(false) (Case 1.png)
    2.3. Remarks .Render() (Case 2.png)

    Click image for larger version. 

Name:	Case1.png 
Views:	150 
Size:	19.3 KB 
ID:	5448Click image for larger version. 

Name:	case2.png 
Views:	145 
Size:	19.6 KB 
ID:	5449
  5. #5
    The AddColumn and RebuildMeta should be also used only during an AJAX request.

    1. Replace
    GridPanel1.AddColumn(objExtCol)
    with
    GridPanel1.ColumnModel.Columns.Add(objExtCol)
    2. Remove
    Store1.RebuildMeta()
    3. Place the Store before the GridPanel.
    <ext:Store ID="Store1" runat="server" />
    
    <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" />
  6. #6
    Same result after update the code.
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frmGridRenderTest.aspx.vb" Inherits="prjExtNetTest.frmGridRenderTest" %>
    
    <!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">
        <div>
        
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:Store ID="Store1" runat="server"></ext:Store>
            <ext:GridPanel ID="GridPanel1" runat="server" Height="300" Title="Title" StoreID ="Store1"/>
            <ext:Button ID="Button1" runat="server" Text="Call Render SelfRender=True" />
            <ext:Button ID="Button3" runat="server" Text="Call Render SelfRender=False" />
            <ext:Button ID="Button2" runat="server" Text="Remark Call Render" />
            <br />
            <ext:Label ID="Label1" runat="server" />
        </div>
        </form>
    </body>
    </html>
    Imports Ext.Net
    Public Class clsGridCol
        Private mCol1 As String
        Private mCol2 As String
        Public Property Col1 As String
            Get
                Return mCol1
            End Get
            Set(value As String)
                mCol1 = value
            End Set
        End Property
        Public Property Col2 As String
            Get
                Return mCol2
            End Get
            Set(value As String)
                mCol2 = value
            End Set
        End Property
    End Class
    Public Class frmGridRenderTest
        Inherits System.Web.UI.Page
    
        Private mobjLstOfGridCol As List(Of clsGridCol)
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            ''LoadGrid(False)
        End Sub
        Public Sub LoadGrid(ByVal blnCallRender As Boolean, Optional blnSelfRender As Boolean = True)
            Dim objGirdCol As clsGridCol
            Dim i As Integer
            Dim objExtCol As Ext.Net.Column
            Dim objModel As New Ext.Net.Model
    
            mobjLstOfGridCol = New List(Of clsGridCol)
            objModel.Fields.Clear()
    
            objModel.Fields.Add("Col1", Ext.Net.ModelFieldType.String)
            objModel.Fields.Add("Col2", Ext.Net.ModelFieldType.String)
            objModel.IDProperty = "Col1"
            GridPanel1.RemoveAllColumns()
            For i = 1 To 10
                objGirdCol = New clsGridCol
                objGirdCol.Col1 = "Col1 - " & i
                objGirdCol.Col2 = "Col2 - " & i
                mobjLstOfGridCol.Add(objGirdCol)
            Next
            Label1.Text = mobjLstOfGridCol.Count & " update at " & Now.ToString
            objExtCol = New Ext.Net.Column
            objExtCol.Text = "Col1"
            objExtCol.DataIndex = "Col1"
            'GridPanel1.AddColumn(objExtCol)
            GridPanel1.ColumnModel.Columns.Add(objExtCol)
    
            objExtCol = New Ext.Net.Column
            objExtCol.Text = "Col2"
            objExtCol.DataIndex = "Col2"
            'GridPanel1.AddColumn(objExtCol)
            GridPanel1.ColumnModel.Columns.Add(objExtCol)
    
    
            Store1.DataSource = mobjLstOfGridCol
            Store1.Model.Clear()
            Store1.Model.Add(objModel)
            Store1.DataBind()
            If blnCallRender = True Then
                GridPanel1.Render(blnSelfRender)
            End If
    
        End Sub
    
        Protected Sub Button1_DirectClick(sender As Object, e As Ext.Net.DirectEventArgs) Handles Button1.DirectClick
            LoadGrid(True, True)
        End Sub
    
        Protected Sub Button2_DirectClick(sender As Object, e As Ext.Net.DirectEventArgs) Handles Button2.DirectClick
            LoadGrid(False)
        End Sub
    
        Protected Sub Button3_DirectClick(sender As Object, e As Ext.Net.DirectEventArgs) Handles Button3.DirectClick
            LoadGrid(True, False)
        End Sub
    End Class
  7. #7
    I see you commented a LoadGrid call in the Page_Load. Probably, this is a reason why the GridPanel doesn't appear.
  8. #8
    Not page_load issue, but seems i find some hints:
    I try to run all the code dynamic, create ext.net.gridpanel and ext.net.store in code and it works.
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim objGrid As New Ext.Net.GridPanel
            Dim objStore As New Ext.Net.Store
            objGrid.ID = "myGrid"
            objGrid.Title = "MyGrid Gen"
            objStore.ID = "myStore"
            Me.Controls.Add(DynamicCreateGrid(objGrid, objStore))
        End Sub
    
       Public Function DynamicCreateGrid(ByRef objMyGrid As Ext.Net.GridPanel, ByRef objMyStore As Ext.Net.Store) As Ext.Net.GridPanel
            Dim objGirdCol As clsGridCol
            Dim i As Integer
            Dim objExtCol As Ext.Net.Column
            Dim objModel As New Ext.Net.Model
            'Dim objMyStore As Ext.Net.Store
            'Dim objMyGrid As New Ext.Net.GridPanel
            mobjLstOfGridCol = New List(Of clsGridCol)
            objModel.Fields.Clear()
    
            objModel.Fields.Add("Col1", Ext.Net.ModelFieldType.String)
            objModel.Fields.Add("Col2", Ext.Net.ModelFieldType.String)
            objModel.IDProperty = "Col1"
            GridPanel1.RemoveAllColumns()
            For i = 1 To 10
                objGirdCol = New clsGridCol
                objGirdCol.Col1 = "Col1 - " & i
                objGirdCol.Col2 = "Col2 - " & i
                mobjLstOfGridCol.Add(objGirdCol)
            Next
    
    
    
            objMyStore.Model.Clear()
            objMyStore.Model.Add(objModel)
            objMyStore.DataSource = mobjLstOfGridCol
            ''objMyStore.DataBind()
    
    
    
            objMyGrid.ColumnModel.Columns.Clear()
            'objMyGrid.RemoveAllColumns()
            objExtCol = New Ext.Net.Column
            objExtCol.ID = "Col1"
            objExtCol.Text = "Col1"
            objExtCol.DataIndex = "Col1"
            'objMyGrid.AddColumn(objExtCol)
            objMyGrid.ColumnModel.Columns.Add(objExtCol)
    
            objExtCol = New Ext.Net.Column
            objExtCol.Text = "Col2"
            objExtCol.DataIndex = "Col2"
            'objMyGrid.AddColumn(objExtCol)
            objMyGrid.ColumnModel.Columns.Add(objExtCol)
    
            'Dim objExtView As New Ext.Net.GridView
            'objExtView.StripeRows = True
            'objExtView.TrackOver = True
            'objMyGrid.View.Clear()
            'objMyGrid.View.Add(objExtView)
            objMyGrid.Store.Clear()
            objMyGrid.Store.Add(objMyStore)
            'If blnCallRender = True Then
            '    GridPanel1.Render(blnSelfRender)
            'End If
            Return objMyGrid
        End Function
    And I compare both method 1)already declare GridPanel in HTML Tag, 2) not include any GridPanel or Store in HTML, just remind ResourceManager
    And I think the problem may come from Store. If Store already declare on HTML Tag there are no data:[]

    Following is generate //<![CDATA[ //]]>
    Ext.net.ResourceMgr.init({
        id: "ResourceManager1",
        as pForm: "form1"
    });
    Ext.onReady(function () {
        Ext.ns("App .direct");
        Ext.apply(App.direct, {
            LoadGrid: function (config) {
                return Ext.net.DirectMethod.request("LoadGrid", Ext.applyI f(config || {}, {}));
            }
        });
        window.App.Store1 = Ext.create("Ext.data.Store", {
            storeId: "Store1",
            auto Load: true,
            proxy: {
                type: 'memory'
            }
        });
        Ext.create("Ext. grid.Panel", {
            id: "GridPanel1",
            height: 300,
            renderTo: " App.GridPanel1_Container",
            title: "Title ",
            columns: {}
        });
        Ext.create("Ext.grid.Panel", {
            store: {
                model: Ext.define(Ext.id(), {
                    extend: "Ext.data.Model",
                    fields: [{
                        name: "Col1",
                        type: "string"
                    }, {
                        name: "Col2",
                        type: "str ing"
                    }],
                    idProperty: "Col1"
                }),
                storeId: "myStore",
                autoLoad: true,
                proxy: {
                    data: [{
                        "Col1": "Col1 - 1",
                        "Col2": "Col2 - 1"
                    }, {
                        "Col1": "Col1 - 2",
                        "Col2": "Col2 - 2"
                    }, {
                        "Col1": "Col1 - 3",
                        "Col2": "Col2 - 3"
                    }, {
                        "Col1": "Col1 - 4",
                        "Col2": "Col2 - 4"
                    }, {
                        "Col1": "Col1 - 5",
                        "Col2": "Col2 - 5"
                    }, {
                        "Col1": "Col1 - 6",
                        "Col2": "Col2 - 6"
                    }, {
                        "Col1": "Col1 - 7",
                        "Col2": "Col2 - 7"
                    }, {
                        "Col1": "Col1 - 8",
                        "Col2": "Col2 - 8"
                    }, {
                        "Col1": "Col1 - 9",
                        "Col2": "Col2 - 9"
                    }, {
                        "Col1": "Col1 - 10",
                        "Col2": "Col2 - 10"
                    }],
                    type: 'memory'
                }
            },
            id: "myGrid",
            renderTo: "App.myGrid_Contai ner",
            title: "MyGrid Gen",
            columns: {
                items: [{
                    id: "Col1",
                    dataIndex: "Col1",
                    text: "Col1"
                }, {
                    dataInde x: "Col2",
                    text: "Col2"
                }]
            }
        });
        App.GridPanel1.removeAllColumns();
    });
    Last edited by Daniil; Jan 23, 2013 at 6:48 AM. Reason: Formatted JavaScript
  9. #9
    Regarding your example from the post #6.

    You should uncomment
    LoadGrid(False)
    in the Page_Load and remove
    GridPanel1.RemoveAllColumns()
    The RemoveAllColumns should be also called during an AJAX request only.
  10. #10
    Your right, RemoveAllColumns(). it is work now. Thanks

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frmGridRenderTest.aspx.vb" Inherits="prjExtNetTest.frmGridRenderTest" %>
    
    <!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">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            <ext:Store ID="Store1" runat="server">
            </ext:Store>
            <ext:GridPanel ID="GridPanel1" runat="server">
            </ext:GridPanel>
            <br />
            <ext:Button ID="Button1" runat="server" Text="Submit" />
        </div>
        </form>
    </body>
    </html>
    Imports Ext.Net
    Public Class clsGridCol
        Private mCol1 As String
        Private mCol2 As String
        Public Property Col1 As String
            Get
                Return mCol1
            End Get
            Set(value As String)
                mCol1 = value
            End Set
        End Property
        Public Property Col2 As String
            Get
                Return mCol2
            End Get
            Set(value As String)
                mCol2 = value
            End Set
        End Property
    End Class
    Public Class frmGridRenderTest
        Inherits System.Web.UI.Page
        Private mobjLstOfGridCol As List(Of clsGridCol)
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim objGrid As New Ext.Net.GridPanel
            Dim objStore As New Ext.Net.Store
            objGrid.ID = "myGrid"
            objGrid.Title = "MyGrid Gen"
            objStore.ID = "myStore"
            Me.Controls.Add(DynamicCreateGrid(objGrid, objStore))
            DynamicCreateGrid(GridPanel1, Store1)
        End Sub
        Public Function DynamicCreateGrid(ByRef objMyGrid As Ext.Net.GridPanel, ByRef objMyStore As Ext.Net.Store) As Ext.Net.GridPanel
            Dim objGirdCol As clsGridCol
            Dim i As Integer
            Dim objExtCol As Ext.Net.Column
            Dim objModel As New Ext.Net.Model
            mobjLstOfGridCol = New List(Of clsGridCol)
            objModel.Fields.Clear()
            objModel.Fields.Add("Col1", Ext.Net.ModelFieldType.String)
            objModel.Fields.Add("Col2", Ext.Net.ModelFieldType.String)
            objModel.IDProperty = "Col1"
            For i = 1 To 10
                objGirdCol = New clsGridCol
                objGirdCol.Col1 = "Col1 - " & i
                objGirdCol.Col2 = "Col2 - " & i
                mobjLstOfGridCol.Add(objGirdCol)
            Next
    
            objMyStore.Model.Clear()
            objMyStore.Model.Add(objModel)
            objMyStore.DataSource = mobjLstOfGridCol
            objMyStore.DataBind()
            objMyGrid.ColumnModel.Columns.Clear()
            objExtCol = New Ext.Net.Column
    
            objExtCol.Text = "Col1"
            objExtCol.DataIndex = "Col1"
            objMyGrid.ColumnModel.Columns.Add(objExtCol)
    
            objExtCol = New Ext.Net.Column
            objExtCol.Text = "Col2"
            objExtCol.DataIndex = "Col2"
            objMyGrid.ColumnModel.Columns.Add(objExtCol)
    
    
            objMyGrid.Store.Clear()
            objMyGrid.Store.Add(objMyStore)
            If Ext.Net.X.IsAjaxRequest = True Then
                objMyGrid.Render(True)
            End If
    
            Return objMyGrid
        End Function
    
        Protected Sub Button1_DirectClick(sender As Object, e As Ext.Net.DirectEventArgs) Handles Button1.DirectClick
            DynamicCreateGrid(GridPanel1, Store1)
        End Sub
    End Class

Similar Threads

  1. [CLOSED] Error in Namespace when PartialViewResult render.
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 28, 2012, 2:10 PM
  2. [CLOSED] Render FileUploadField on hidden panel JS error
    By bakardi in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 17, 2012, 6:46 PM
  3. [CLOSED] GridPanel... error after render page.
    By supera in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 23, 2012, 2:24 PM
  4. [1.0] GridPanel.render() error in BorderLayout
    By d.urazalinov in forum 1.x Help
    Replies: 3
    Last Post: Jun 22, 2010, 6:07 PM
  5. design time ,in masterpage render error;
    By csljr in forum 1.x Help
    Replies: 2
    Last Post: Jun 01, 2009, 3:47 AM

Tags for this Thread

Posting Permissions