[CLOSED] JScript compilation error: Syntax error (eval(result.script));

Page 2 of 2 FirstFirst 12
  1. #11
    same error
  2. #12
    Please remove <ext:XScript> leaving <script> only in Content.
  3. #13
    For this I will not use #{}, but others will do it, so can't do that.

    Other issues what I found and which will cause previous - I have removed all scripts and try to add this control: I still get an error:
    Microsoft JScript runtime error: Object doesn't support this action
    in:
    return d.render?d:new b[d.xtype||e](d)
    d:
    ownerCt: {...}
        id: "ProjectDocuments1_cartItemsNGControl_tgDistribution"
        xtype: "treegrid"
        columnWidth: 0.5
        enableDD: true
        nodes: [[object Object]]
        columns: [[object Object],[object Object]]
    
    d.render
    undefined
    So looks like treegrid doesn't support render method and I can't use this for dynamic control? Please confirm.
  4. #14
    Quote Originally Posted by bakardi View Post
    For this I will not use #{}, but others will do it, so can't do that.
    You don't need <ext:XScript> when a script is inside Content, though you can use #{}.

    Here is my test case (refactored/simplified version of your code).

    Example Page
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void OnBeforeShow(object sender, DirectEventArgs e)
        {
            var uc = LoadControl("TestUC.ascx");
            uc.ID = "TestUC1";
            this.Container1.ContentControls.Add(uc);
            this.Container1.Render();
        }
    </script>
    <!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>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Window 
                ID="Window1"
                runat="server" 
                Width="500" 
                Height="500" 
                Hidden="true" 
                Layout="Fit">
                <Items>
                    <ext:Container ID="Container1" runat="server" />
                </Items>
                <DirectEvents>
                    <BeforeShow OnEvent="OnBeforeShow">
                        <EventMask ShowMask="true" />
                    </BeforeShow>
                </DirectEvents>
            </ext:Window>
            <ext:Button runat="server" Text="Show window">
                <Listeners>
                    <Click Handler="Window1.show();" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    Example User Control
    <%@ Control Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <ext:FitLayout runat="server">
        <Items>
            <ext:Container runat="server" Layout="ColumnLayout">
                <Content>
                    <script type="text/javascript">
                        var setInfo = function (values) {
                            return "#{TreeGrid1}"; /* just to demostrate that #{} works */
                        };
                    </script>
                </Content>
                <LayoutConfig>
                    <ext:ColumnLayoutConfig Split="true" />
                </LayoutConfig>
                <Items>
                    <ext:TreePanel 
                        runat="server" 
                        ColumnWidth="0.25" 
                        RootVisible="false">
                        <Root>
                            <ext:TreeNode Text="Cart Items">
                                <Nodes>
                                    <ext:TreeNode Text="Hello World!" />
                                </Nodes>
                            </ext:TreeNode>
                        </Root>
                    </ext:TreePanel>
                    <ext:TreeGrid 
                        ID="TreeGrid1" 
                        runat="server" 
                        ColumnWidth="0.5" 
                        RootVisible="false">
                        <Columns>
                            <ext:TreeGridColumn Header="Name" DataIndex="Name" Width="100" />
                            <ext:TreeGridColumn Header="Descpiption" Width="200">
                                <XTemplate runat="server">
                                    <Html>
                                        {.:this.setInfo}
                                    </Html>
                                    <Functions>
                                        <ext:JFunction Name="setInfo" Fn="setInfo" />
                                    </Functions>
                                </XTemplate>
                            </ext:TreeGridColumn>
                        </Columns>
                        <Root>
                            <ext:TreeNode Text="Cart Distribution">
                                <Nodes>
                                    <ext:TreeNode Text="test">
                                        <CustomAttributes>
                                            <ext:ConfigItem 
                                                Name="Name" 
                                                Value="Some name" 
                                                Mode="Value" />
                                            <ext:ConfigItem 
                                                Name="Descpiption" 
                                                Value="Some description" 
                                                Mode="Value" />
                                        </CustomAttributes>
                                    </ext:TreeNode>
                                </Nodes>
                            </ext:TreeNode>
                        </Root>
                    </ext:TreeGrid>
                        <ext:PropertyGrid 
                            runat="server" 
                            ColumnWidth="0.25" >
                            <Source>
                                <ext:PropertyGridParameter Name="test" Value="test" />
                            </Source>
                        </ext:PropertyGrid>
                </Items>
            </ext:Container>
        </Items>
    </ext:FitLayout>
  5. #15
    Still have same issue. Noticed if I replace load the control without
     <ext:TreeGridColumn Width="100" Header="Descpiption">
                                <XTemplate ID="XTemplate1" runat="server">
                                    <Html>
                                               {.:this.setInfo}
                                            </Html>
                                    <Functions>
                                        <ext:JFunction Name="setInfo" Fn="setInfo" />
                                    </Functions>
                                </XTemplate>
                            </ext:TreeGridColumn>
    and pub click handler to propertygrid I have this function available and no error happened. I think the problem in browser/browes version or different speed of rendering.
  6. #16
    This case works fine:
     <ext:PropertyGrid ID="pgCommon" runat="server" AutoScroll="true" Editable="false" ColumnWidth="0.25">
                        <Source>
                            <ext:PropertyGridParameter Name="test" Value="test" />
                        </Source>
                        <Listeners>
                            <Click Handler="setInfo();" />
                        </Listeners>
                    </ext:PropertyGrid>
  7. #17
    Please note that script tag from Content is rendered after config script execution (because browser cannot update DOM and execute script at the same time)

    Try this
     <ext:JFunction Name="setInfo" Fn="function(values){return setInfo(values);}" />
  8. #18
    Yes, It is works!!! Thanks!
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 0
    Last Post: Aug 09, 2012, 1:27 PM
  2. [CLOSED] Syntax error in generated script when using a Template
    By IT1333 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 05, 2011, 7:52 AM
  3. Replies: 4
    Last Post: Jan 25, 2011, 10:39 AM
  4. Replies: 2
    Last Post: Jul 29, 2009, 1:57 PM
  5. [CLOSED] AjaxMethod Error = BADRESPONSE: Syntax error
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 05, 2008, 6:37 PM

Posting Permissions