Microsoft JScript runtime error: Sys.ArgumentException: The format string contains an unmatched opening or closing brace.

  1. #1

    Microsoft JScript runtime error: Sys.ArgumentException: The format string contains an unmatched opening or closing brace.

    Hi Guys,

    Who can help me with this error that seems to be a bug?


    Microsoft JScript runtime error: Sys.ArgumentException: The format string contains an unmatched opening or closing brace.
    Parameter name: format

    When I select the combo box fire the event select (
    <DirectEvents><Select OnEvent="cbCurso_Change"/></DirectEvents>
    ) . that change the text box

    (
    </ext:ComboBox> <ext:TextField ID="tfProvaIngresso" runat="server"/>
    property indicatorText (see c# code)



    and ? the error appears


    Please see in attach the doc. that explain everything.

    Thank you!

    ASP.NET Code


    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
    <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
    <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Candidaturas.aspx.cs" Inherits="Candidaturas.Layouts.Candidaturas.Candidaturas" DynamicMasterPageFile="~masterurl/default.master" %>
    <%@ Register Assembly="Ext.Net, Version=1.3.0.1840, Culture=neutral, PublicKeyToken=2e12ce3d0176cd87"
        Namespace="Ext.Net" TagPrefix="ext" %>
    
    <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <style type="text/css">
            .Delete {
                background-image:url(/_layouts/candidaturas/Ext.Net/icons/delete.png) !important;
            }
            .Edit {
                background-image:url(/_layouts/Candidaturas/icons/note_edit.png) !important;
            }
            .Add {
                background-image:url(/_layouts/Candidaturas/icons/add.png) !important;
            }
            .Table {
                background-image:url(/_layouts/candidaturas/icons/table.png) !important;
            }
             .Disk {
                background-image:url(/_layouts/candidaturas/icons/disk.png) !important;
            }
    </style>
    </asp:Content>
    
    <asp:Content ID="Main" 
                 ContentPlaceHolderID="PlaceHolderMain" 
                 runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Slate">
        </ext:ResourceManager>
        <ext:Store ID="stCandidaturas" 
                   runat="server">
                <Reader>
                        <ext:JsonReader>
                                <Fields>
                                        <ext:RecordField Name="ID" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="aluno" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="curso" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="tipoIngresso" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="faseIngresso" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="estado" >
                                        </ext:RecordField>
                                </Fields>
                        </ext:JsonReader>
                </Reader>
        </ext:Store>
         <ext:Store ID="stCursos" 
                   runat="server">
                <Reader>
                        <ext:JsonReader>
                                <Fields>
                                        <ext:RecordField Name="ID" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="title" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="tipoCurso" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="provaIngresso" >
                                        </ext:RecordField>
                                </Fields>
                        </ext:JsonReader>
                </Reader>
        </ext:Store>
         <ext:Store ID="stFasesIngresso" 
                   runat="server">
                <Reader>
                        <ext:JsonReader>
                                <Fields>
                                        <ext:RecordField Name="ID" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="ano" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="datainicio" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="datafim" >
                                        </ext:RecordField>
                                         <ext:RecordField Name="fase" >
                                        </ext:RecordField>
                                </Fields>
                        </ext:JsonReader>
                </Reader>
        </ext:Store>
         <ext:Store ID="stRegimes" 
                   runat="server">
                <Reader>
                        <ext:JsonReader>
                                <Fields>
                                        <ext:RecordField Name="ID" >
                                        </ext:RecordField>
                                        <ext:RecordField Name="regime" >
                                        </ext:RecordField>
                                </Fields>
                        </ext:JsonReader>
                </Reader>
        </ext:Store>
       
        <ext:Panel runat="server" 
                   Header="False" 
                   MonitorResize="True" 
                   Layout="FitLayout">
             <Items>
                <ext:GridPanel ID="gpCandidaturas" runat="server" 
                                                   Height="300" 
                                                   Title="Candidaturas" 
                                                   StoreID="stCandidaturas" 
                                                   Frame="True"  
                                                   TrackMouseOver="True" 
                                                   iconcls="Table" 
                                                   MonitorResize="true" 
                                                   AutoExpandColumn="aluno"
                                                   >
                    <TopBar>
                        <ext:Toolbar runat="server" 
                                     AutoHeight="True" 
                                     MonitorResize="True">
                            <Items>
                            
                                <ext:Button ID="btAdd" 
                                            runat="server" 
                                            IconCls="Add">
                                        <DirectEvents>
                                            <Click OnEvent="btAdd_onClick">
                                            </Click>
                                        </DirectEvents>
                                </ext:Button>
    
                                <ext:Button ID="Button1" 
                                            runat="server" 
                                            IconCls="Edit"  
                                            />
                                <ext:ToolbarSeparator />
                                <ext:Button ID="Button2" 
                                            runat="server" 
                                            IconCls="Edit" />
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
                    <ColumnModel runat="server">
                        <Columns>
                                <ext:Column Header="ID" 
                                            DataIndex="ID"
                                             />
                                <ext:Column Header="Aluno" 
                                            DataIndex="aluno">
                                </ext:Column>
                                <ext:Column Header="Curso" 
                                            DataIndex="curso">
                                    
                                </ext:Column>
                                <ext:Column Header="Tipo de Ingresso" 
                                            DataIndex="tipoIngresso" />
                                <ext:Column Header="Fase de Ingresso" 
                                            DataIndex="faseIngresso" />
                                <ext:Column Header="Estado" 
                                            DataIndex="estado" />
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:RowSelectionModel ID="RowSelectionModel1" 
                                               runat="server" 
                                               SingleSelect="true" />
                    </SelectionModel>
                    <BottomBar>
                        <ext:PagingToolbar id="pagToolbar" 
                                           runat="server"
                                           PageSize="10" 
                                           DisplayInfo="true"
                                           DisplayMsg="Candidaturas {0} - {1} of {2}" 
                                           MonitorResize="True">
                        </ext:PagingToolbar>
                    </BottomBar>
                </ext:GridPanel>
             </Items>
        </ext:Panel>
        <p>
        <asp:TextBox runat="server" ID="msg" 
                     Width="200px"/>
        </p>
        
         <ext:Window 
                ID="wAdd" 
                runat="server" 
                Title="Adicionar Candidatura" 
                Frame="true" 
                Width="650" 
                Height="600" 
                Hidden="true" 
                Layout="FitLayout"
                >
                <Items>
                    <ext:TabPanel ID="TabPanel1" runat="server" height="550px">
                        <Items>
                            <ext:Panel ID="plCurso" 
                                       runat="server" 
                                       Title="Curso"  
                                       Frame="True" 
                                       AnchorHorizontal="100%" 
                                       Layout="FormLayout" 
                                       LabelWidth="170">
                                <Items>
                                             <ext:ComboBox ID="cbCurso" 
                                                              runat="server" 
                                                              StoreID="stCursos" 
                                                              Editable="False" 
                                                              DisplayField="title" 
                                                              ValueField="ID"
                                                              AllowBlank="False" 
                                                              AutoHeight="True"
                                                              EmptyText="Seleccione Curso..."
                                                              Mode="Local" 
                                                              IsFormField="True" 
                                                              Width="250px" 
                                                              FieldLabel="Curso"
                                                              AnchorHorizontal="100%"
                                                              LabelWidth="150"
                                                              ForceSelection="true" 
                                                              TriggerAction="All" 
                                                              >
                                                         <DirectEvents>
                                                            <Select OnEvent="cbCurso_Change"/>
                                                         </DirectEvents>    
                                                
                                             </ext:ComboBox>
                                             <ext:ComboBox ID="cbFasesIngresso" 
                                                              runat="server" 
                                                              StoreID="stFasesIngresso" 
                                                              Editable="False" 
                                                              DisplayField="fase" 
                                                              ValueField="fase"  
                                                              AllowBlank="False" 
                                                              SelectedIndex="0" 
                                                              AutoHeight="True"
                                                              Mode="Local" 
                                                              LabelStyle="font-weight:bold;" 
                                                              IsFormField="True" 
                                                              Width="250px" 
                                                              FieldLabel="Fases de Ingresso"
                                                              AnchorHorizontal="100%"
                                                              LabelWidth="150"
                                                              >
                                             </ext:ComboBox>
                                             <ext:ComboBox ID="cbRegime" 
                                                              runat="server" 
                                                              Editable="False" 
                                                              DisplayField="regime" 
                                                              ValueField="regime"  
                                                              AllowBlank="False" 
                                                              SelectedIndex="0" 
                                                              AutoHeight="True"
                                                              Mode="Local" 
                                                              LabelStyle="font-weight:bold;" 
                                                              IsFormField="True" 
                                                              Width="250px" 
                                                              FieldLabel="Regime"
                                                              AnchorHorizontal="100%"
                                                              LabelWidth="150"
                                                              StoreID="stRegimes"
                                                              >
                                             </ext:ComboBox>      
     <ext:TextField ID="tfProvaIngresso" runat="server">
                                    </ext:TextField>
                                </Items>
                            </ext:Panel>
                            <ext:Panel ID="plAluno" runat="server" Title="Aluno">
                                <Items>
                                </Items>
                            </ext:Panel>
                            <ext:Panel ID="plIESF" runat="server" Title="IESF">
                                <Items>
                                </Items>
                            </ext:Panel>
                        </Items>
                    </ext:TabPanel>
                </Items>
                <Buttons>
                <ext:Button runat="server" ID="btClose" Text="Fechar"></ext:Button>
                </Buttons>
                <BottomBar>
                             <ext:StatusBar ID="StatusBar1" runat="server" Height="35">
                             </ext:StatusBar>
                 </BottomBar>
                <Listeners>
                </Listeners>
         </ext:Window>
    </asp:Content>
    
    <asp:Content ID="PageTitle" 
                 ContentPlaceHolderID="PlaceHolderPageTitle" 
                 runat="server">
    Manuentação de Candidaturas
    </asp:Content>
    
    <asp:Content ID="PageTitleInTitleArea" runat="server"
                 ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"  >
    Manuentação de Candidaturas
    </asp:Content>
    c# Code
    protected void cbCurso_Change(object sender, DirectEventArgs e)
            {
                /* tbTipoIngresso.Disabled = false;{*/
               string cursoID = cbCurso.SelectedItem.Value.ToString();
                List<CursosDS> sltCurso = new List<CursosDS>();
               sltCurso = new LoadCursos().GetCursoByID(cursoID);
               // lê prova de ingresso associado ao curso
                foreach (CursosDS cItem in sltCurso)
                {
                    tfProvaIngresso.IndicatorText = cItem.provaIngresso;
                }
             
            }
    Attached Thumbnails Click image for larger version. 

Name:	errorDetail7.jpg 
Views:	97 
Size:	66.4 KB 
ID:	4029   Click image for larger version. 

Name:	errorDetail6.jpg 
Views:	79 
Size:	76.0 KB 
ID:	4030   Click image for larger version. 

Name:	errorDetail5.jpg 
Views:	102 
Size:	76.0 KB 
ID:	4031   Click image for larger version. 

Name:	errorDetail2.jpg 
Views:	96 
Size:	95.1 KB 
ID:	4033   Click image for larger version. 

Name:	errorDetail3.jpg 
Views:	99 
Size:	98.0 KB 
ID:	4034  

    Last edited by Daniil; Mar 29, 2012 at 4:22 PM. Reason: Please use [CODE] tags
  2. #2
    Hi,

    The JavaScript code that I see on the screen-shots is not a part of Ext.NET.

    I've just check it up - IndicatorText is changed successfully during DirectEvent.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void ChangeIndicatorText(object sender, DirectEventArgs e)
        {
            this.TextField1.IndicatorText = "New IndicatorText";
        }
    </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:FormPanel runat="server">
                <Items>
                    <ext:TextField ID="TextField1" runat="server" IndicatorText="Initial IndicatorText" />
                </Items>
            </ext:FormPanel>
    
            <ext:Button runat="server" Text="Change IndicatorText" OnDirectClick="ChangeIndicatorText" />
        </form>
    </body>
    </html>
  3. #3
    Hi,

    Thank you for your answer.

    I found the bug.

    look this code :
    This is fired when I select an Item on combobox.

    The error is show when I try to access the method in bold.
    I don't know Why , if I delete the call all run right .


    protected void cbCurso_Change(object sender, DirectEventArgs e)
            {
                /* tbTipoIngresso.Disabled = false;{*/
               string cursoID = cbCurso.SelectedItem.Value.ToString();
                List<CursosDS> sltCurso = new List<CursosDS>();
               sltCurso = new LoadCursos().GetCursoByID(cursoID);
               // lê prova de ingresso associado ao curso
                foreach (CursosDS cItem in sltCurso)
                {
                    tfProvaIngresso.IndicatorText = cItem.provaIngresso;
                }
              
            }






    Quote Originally Posted by Daniil View Post
    Hi,

    The JavaScript code that I see on the screen-shots is not a part of Ext.NET.

    I've just check it up - IndicatorText is changed successfully during DirectEvent.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void ChangeIndicatorText(object sender, DirectEventArgs e)
        {
            this.TextField1.IndicatorText = "New IndicatorText";
        }
    </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:FormPanel runat="server">
                <Items>
                    <ext:TextField ID="TextField1" runat="server" IndicatorText="Initial IndicatorText" />
                </Items>
            </ext:FormPanel>
    
            <ext:Button runat="server" Text="Change IndicatorText" OnDirectClick="ChangeIndicatorText" />
        </form>
    </body>
    </html>
    Last edited by Daniil; Apr 01, 2012 at 3:40 PM. Reason: Please use [CODE] tags
  4. #4
    Well, I know nothing about it:
    sltCurso = new LoadCursos().GetCursoByID(cursoID);
    Please provide more details.
  5. #5
    Hi Daniil,

    Thank you for your answer.

    Please see classes below .

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    
    
        class CursosDS
        {
    
            public CursosDS(string id, string title,string grau, string tipocurso, string provaIngresso )
            {
                this.ID = id;
                this.title = title;
                this.grau = grau;
                this.tipoCurso = tipocurso;
                this.provaIngresso = provaIngresso;
            }
    
                public string ID { get; set; }
                public string title { get; set; }
                public string grau { get; set; }
                public string tipoCurso { get; set; }
                public string provaIngresso { get; set; }
     
        }
    ---------Class LoadCursos.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Security;
    
    
        class LoadCursos
        {
            List<CursosDS> lis = new List<CursosDS>();
           // constructrs
           public LoadCursos()
            {
               
            }
         
    
            public  List<CursosDS>  GetAll()
            {
               
                using (SPSite sp = SPContext.Current.Site)
                {
                    using (SPWeb web = sp.OpenWeb())
                    {
                        try
                        {
                            SPList li = web.Lists["Cursos"];
                            SPQuery qry = new SPQuery();
                            SPListItemCollection ic = li.GetItems(qry);
                            var itm = from SPListItem ir in ic
                                      select new
                                      {
                                          ID = ir["ID"].ToString(),
                                          curso = ir["Title"].ToString(),
                                          grau = ir["Grau"].ToString(),
                                          tipoCurso = ir["TipoCurso"].ToString(),
                                          provaIngresso = ir["ProvaDeIngresso"] == null ? "" : ir["ProvaDeIngresso"].ToString()
                                      };
    
                            foreach (var litem in itm)
                            {
                                CursosDS ds = new CursosDS(litem.ID, litem.curso, litem.grau, litem.tipoCurso, litem.provaIngresso);
    
                                //CursosDS ds = new CursosDS(litem["ID"].ToString().Trim(), litem["Title"].ToString().Trim(), litem["Grau"].ToString().Trim(), litem["TipoCurso"].ToString().Trim(), litem["ProvaDeIngresso"].ToString().Trim());
                                lis.Add(ds);
                            }
                        }
                        catch (Exception ex)
                        {
    
                            throw ex;
    
                        }
                        finally
                        {
                           // if (web != null) web.Dispose();
                           // if (sp != null) sp.Dispose();
                        }
                    }
                }
                    return lis;
            }
    
            public List<CursosDS> GetCursoByID(string _ID)
            {
                List<CursosDS> list =  this.GetAll();
    
                List<CursosDS> lProvaIngresso = new List<CursosDS>();
    
               
    
                var item = from CursosDS ir in list
                           where ir.ID == _ID
                           select new
                          {
                              ID = ir.ID.ToString(),
                              curso = ir.title.ToString(),
                              grau =  ir.grau.ToString(),
                              tipocurso = ir.tipoCurso.ToString(),
                              provaIngresso = ir.provaIngresso == null ? "" : ir.provaIngresso.ToString()
                          };
    
                foreach (var litem in item)
                {
                    
                   CursosDS ds=new CursosDS(litem.ID,litem.curso, litem.grau,litem.tipocurso, litem.provaIngresso);
                   lProvaIngresso.Add(ds);
                }
                return lProvaIngresso;
            }
    
            // get by name CUrso
            public List<CursosDS> GetCursoByName(string _Name)
            {
                List<CursosDS> list = this.GetAll();
    
                List<CursosDS> lProvaIngresso = new List<CursosDS>();
                var item = from CursosDS ir in list
                           where ir.title == _Name
                           select new
                           {
                               ID = ir.ID.ToString(),
                               curso = ir.title.ToString(),
                               grau = ir.grau.ToString(),
                               tipocurso = ir.tipoCurso.ToString(),
                               provaIngresso = ir.provaIngresso == null ? "" : ir.provaIngresso.ToString()
                           };
    
                foreach (var litem in item)
                {
    
                    CursosDS ds = new CursosDS(litem.ID, litem.curso, litem.grau, litem.tipocurso, litem.provaIngresso);
                    lProvaIngresso.Add(ds);
                }
                return lProvaIngresso;
            }
        }
    Last edited by geoffrey.mcgill; Apr 02, 2012 at 3:35 PM. Reason: please use [CODE] tags
  6. #6
    Hello,

    In future posts, please ensure you wrap your code samples in [CODE] tags. This will properly format your code sample, which will help with readability.
    Geoffrey McGill
    Founder
  7. #7
    Well, I can't see how it can cause a JavaScript error you are facing.

    What is a response of DirectEvent?

Similar Threads

  1. Replies: 5
    Last Post: Mar 16, 2012, 2:47 PM
  2. Microsoft JScript runtime error: Object expected
    By shrenuj_dev in forum 1.x Help
    Replies: 0
    Last Post: May 11, 2011, 5:02 AM
  3. [CLOSED] getItemId - Microsoft JScript runtime error
    By asztern in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 04, 2010, 2:45 PM
  4. Microsoft JScript runtime error
    By kiran malgi in forum 1.x Help
    Replies: 4
    Last Post: May 27, 2010, 1:28 AM
  5. Microsoft JScript runtime error: 'Ext' is undefined
    By Satyanarayana murthy in forum Open Discussions
    Replies: 11
    Last Post: Mar 31, 2010, 11:54 AM

Tags for this Thread

Posting Permissions