[CLOSED] Unable to cast object of type System.Numerics.BigInteger to type System.IConvertible in storeSubmitDataEventArgs object

  1. #1

    [CLOSED] Unable to cast object of type System.Numerics.BigInteger to type System.IConvertible in storeSubmitDataEventArgs object

    Hi,

    I am trying to get the grid store data in the form of xml using storesubmitdataeventargs object. when i try to get e.Xml, it does give an exception
    as attached in Exception.png - Unable to cast object of type 'System.Numerics.BigInteger' to type 'System.IConvertible'.

    I think its because of the big integer numbers in the store. The attached screenshot(BigInteger.png) shows the big numbers with red colored circles.

    Is it not something that ext framework handles for this type of data/ large numbers ? How can i resolve this error? And fyi, it works very well where I am able to generate e.Xml for any store data if there is no numbers with big integer Datatype.

    pls advise as to how i can solve this issue.

    Code: (aspx)
    ---------------

    
      var SubmitValue = function () {
    
                App.Excel_Window.show();
    
                var grid;
                if (App.hdnDBView.value == undefined || App.hdnDBView.value == "")
                {
                    grid = Ext.getCmp("InstanceTable");
    
                }
                else if (App.hdnDBView.value.toLowerCase() == "dbview") 
                {
                    grid = Ext.getCmp("DBTable");
    
                }
    
    
                grid.submitData(false, { isUpload: true });
            }

    
      var ExcelExport = function (fileName) {
       
                var excelFile = "/OperationalControls/data/excel/" + fileName;
                App.Excel_Window.close();
                window.open(excelFile);
    
    
            }
    
    }


    [
    
      <ext:GridPanel ID="DBTable" runat="server" Frame="true" ForceFit="true" Hidden ="true" ButtonAlign="Left" >
                   
                    <Store>
                    
                        <ext:Store ID="DBTableStore" runat="server" AutoLoad="false" OnSubmitData="ExportToExcel">
                            <Proxy>
                                <ext:AjaxProxy Json="true" Url='<%#MainGridStoreURL%>' AutoDataBind="true">
                                    <ActionMethods Read="POST" Create="POST" />
                                    <Headers>
                                        <ext:Parameter Name="Accept" Value="application/json" />
                                        <ext:Parameter Name="Content-Type" Value="application/json" />
                                    </Headers>
                                  <ExtraParams>
                                 <%--<ext:StoreParameter Name="DaysBack" Value="90"/> --%>
                                  <ext:StoreParameter Name="CompType" Value="Sybase DATABASE"/> 
                                  </ExtraParams>
                                    <Writer>
                                        <ext:JsonWriter Root="" Encode="true" />
                                    </Writer>
                                    <Reader>
                                        <ext:JsonReader Root="" />
                                    </Reader>
                                </ext:AjaxProxy>
                            </Proxy>
                            <Model>
                                <ext:Model ID="Model12" runat="server">
                                    <Fields>
                                        <ext:ModelField Name="PARENT_COMPONENT_ID" Type="Int" />
                                        <ext:ModelField Name="COMPONENT_ID" Type="Int" />
                                        <ext:ModelField Name="METRIC_NAME" Type="String" />
                                        <ext:ModelField Name="ENVIRONMENT" Type="String" />
                                        <ext:ModelField Name="COMPONENT_NAME" Type="String" />
                                        <ext:ModelField Name="UNIT" Type="String" />
                                        <ext:ModelField Name="PERC_USED" Type="Float" />
                                        <ext:ModelField Name="PERC_GROWTH" Type="Float" />
                                        <ext:ModelField Name="CAPACITY" Type="Float" />
                                        <ext:ModelField Name="USED" Type="Float" />
                                        <ext:ModelField Name="FREE" Type="Float" />
                                        <ext:ModelField Name="EXPECTED_MAX_DATE" Type="String" >
                                         <%--  <Convert Handler="return Ext.util.Format.date(value, 'M d Y');" />--%>
                                         </ext:ModelField>
                                        <ext:ModelField Name="PEAK" Type="Float" />
                                        <ext:ModelField Name="PEAK_DATE" Type="String">
                                        <%--  <Convert Handler="return Ext.util.Format.date(value, 'M d Y');" />--%>
                                        </ext:ModelField>
                                        <ext:ModelField Name="LAST_WEEK_PEAK" Type="Float" />
                                        <ext:ModelField Name="LAST_7_DAY_INCR" Type="Float" />
                                        <ext:ModelField Name="CAPACITY_NEED_6_MON" Type="Float" />
                                        <ext:ModelField Name="USED_1_MON" Type="Float" />
                                        <ext:ModelField Name="USED_6_MON" Type="Float" />
                                        <ext:ModelField Name="LAST_UPDATED" Type="String" >
                                      <%--  <Convert Handler="return Ext.util.Format.date(value, 'M d Y');" />--%>
                                        </ext:ModelField>
                                        <ext:ModelField Name="WEEKS_OF_DATA" Type="Int" />
                                        
                                    </Fields>
                                </ext:Model>
                            </Model>
                              <Listeners>
                              <BeforeLoad Handler="Ext.getCmp('DBTable').body.mask('Loading...', 'x-mask-loading'); App.btnExportInstances.disable();" Delay="100"/>
            <Load Fn="getDistinctforColumnsDBGrid" />
            <Refresh Handler="Ext.getCmp('DBTable').body.unmask();" />
    
             <%--<Load  Handler="applyFilter('DBTable');" Buffer="250" />--%>
            </Listeners>
                            
                        </ext:Store>
                        
                    </Store>
                    <Plugins>
                        <ext:BufferedRenderer ID="BufferedRenderer2" runat="server" />
                    </Plugins>
                    
                    
                    <ColumnModel ID="DBase" runat="server" >
                    
                        <Columns>
                       
    
    
                    <ext:ImageCommandColumn ID="ViewGraphDB" runat="server" Width="45" >
                                                <Commands>
                                                    <ext:ImageCommand Icon="ChartCurve" CommandName="ViewGraph" ToolTip-Text ="View Graph"/>
                                                </Commands>
                                                <Listeners>
                                                    <Command Handler="#{PopUpWindow}.show();" />
                                                </Listeners>  
                                            </ext:ImageCommandColumn>
    
    
                                             <ext:Column ID="Column8" runat="server" Text="Environment" DataIndex="ENVIRONMENT" Width="150" Selectable="true" Align="Center"
                                >
                                  <HeaderItems>                           
                                <ext:ComboBox 
                                    ID="cboDBEnvt" 
                                    runat="server"
                                    Icon="Magnifier"
                                    TriggerAction="All"
                                    QueryMode="Local"
                                    DisplayField="ENVIRONMENT"
                                    ValueField="ENVIRONMENT">
                                   
                           
                                    <Listeners>
                                        <Change Handler="filterApply();" Buffer="250" />
                                    </Listeners>     
                                    <Plugins>
                                        <ext:ClearButton ID="ClearButton25" runat="server" />
                                    </Plugins>
                                </ext:ComboBox>
                         
                            </HeaderItems>
                                </ext:Column>
    
    
    
                           <ext:Column ID="Column4" runat="server" Text="Component Name" DataIndex="COMPONENT_NAME" Width="225" Selectable="true" Align="Center"
                                >
                                  <HeaderItems>                           
                                <ext:TextField 
                                    ID="txtDBCompName" 
                                    runat="server"
                                    Icon="Magnifier"
                                   >
                           
                                    <Listeners>
                                        <Change Handler="filterApply();" Buffer="250" />
                                    </Listeners>     
                                    <Plugins>
                                        <ext:ClearButton ID="ClearButton5" runat="server" />
                                    </Plugins>
                                </ext:TextField>
                         
                            </HeaderItems>
                                </ext:Column>
                                   <ext:Column ID="Column5" runat="server" Text="Metric Name" DataIndex="METRIC_NAME" Width="150"  Align="Center"
                             >
                                  <HeaderItems>                           
                                <ext:ComboBox 
                                    ID="cboDBMetricName" 
                                    runat="server"
                                    Icon="Magnifier"
                                    TriggerAction="All"
                                    QueryMode="Local"
                                    DisplayField="METRIC_NAME"
                                    ValueField="METRIC_NAME">
                           
                                    <Listeners>
                                        <Change Handler="filterApply();" Buffer="250" />
                                    </Listeners>     
                                  <%--  <Plugins>
                                        <ext:ClearButton ID="ClearButton6" runat="server" />
                                    </Plugins>--%>
                                </ext:ComboBox>
                         
                            </HeaderItems>
                                
                                </ext:Column>
                                  <ext:ComponentColumn ID="ComponentColumn2" runat="server"  Text="% Used"  Align="Center" DataIndex="PERC_USED" Width="100">
                                 <Component>
                                 <ext:ProgressBar ID="ProgressBar1" runat="server">
                                
                                 </ext:ProgressBar>
                                 
                                 </Component>
                                  <Listeners>
                                 <Bind  Handler="cmp.updateProgress((record.get('PERC_USED')/100).toFixed(2), record.get('PERC_USED')+'%')" />
                                 </Listeners>
                                 </ext:ComponentColumn>
                               
                                   <ext:Column ID="Column6" runat="server" Text="Capacity<br>(MB)" DataIndex="CAPACITY" Width="100" Align="Center"
                               />
                                   <ext:Column ID="Column22" runat="server" Text="Used<br>(MB)" DataIndex="USED" Width="100" Align="Center"
                               />
                                   <ext:Column ID="Column23" runat="server" Text="Free<br>(MB)" DataIndex="FREE" Width="100" Align="Center"
                                />
                                   <ext:Column ID="Column24" runat="server" Text="Expected<br>Max Date" DataIndex="EXPECTED_MAX_DATE" Width="200" Align="Center"
                                >
                                <Renderer Fn="RenderColor" />
                                 <HeaderItems>        
                                                  
                                                   <ext:DateField ID="dtDBFilter" runat="server" Editable="false">
                                        <Listeners>
                                            <Change Handler="filterApply();" />
                                        </Listeners>
                                        <Plugins>
                                            <ext:ClearButton ID="ClearButton4" runat="server" />
                                        </Plugins>
                                    </ext:DateField>
                                        
                             
                         
                            </HeaderItems>
                                </ext:Column>
                                
                                 <ext:Column ID="Column26" runat="server" Text="% Growth<br>Rate" Align="Center" DataIndex="PERC_GROWTH" Width="110"
                              >
                                   <Renderer Handler="return Ext.String.format(record.get('PERC_GROWTH') != 0 ?record.get('PERC_GROWTH').toFixed(2)+'%'  : '0 %') "/>
                             
                                 
                               
                                 </ext:Column>
                            
                               
                              
                                   <ext:Column ID="Column27" runat="server" Text="Peak<br>(MB)" DataIndex="PEAK" Align="Center" Width="100"
                                />
                                <ext:Column ID="Column28" runat="server" Text="Last Week<br>Peak<br>(MB)" DataIndex="LAST_WEEK_PEAK" Align="Center" Width="120"
                               />
    
                                 
                                
                                   <ext:Column ID="Column29" runat="server" Text="Date of<br>Peak" DataIndex="PEAK_DATE" Width="150" Align="Center"
                                >
                                  <Renderer Fn="TrimText" />
                                </ext:Column>
                                <ext:Column ID="Column30" runat="server" Text="Last 7 Days<br>Increase<br>(MB)" Align="Center" DataIndex="LAST_7_DAY_INCR" Width="120"
                                 />
                                   <ext:Column ID="Column31" runat="server" Text="Capacity Needed<br>for 6 Months<br>(MB)" Align="Center" DataIndex="CAPACITY_NEED_6_MON" Width="170"
                                >
                                  <Renderer Handler="return Ext.String.format(record.get('CAPACITY_NEED_6_MON').toFixed(2)) "/>
                                </ext:Column>
    
                                 <ext:Column ID="Column32" runat="server" Text="Used in<br>1 Month<br>(MB)" Align="Center" DataIndex="USED_1_MON" Width="150"
                                />
    
                                 <ext:Column ID="Column33" runat="server" Text="Used in<br>6 Months<br>(MB)" Align="Center" DataIndex="USED_6_MON" Width="150"
                                 />
    
                                <ext:Column ID="Column34" runat="server" Text="# Weeks Of<br>Data" DataIndex="WEEKS_OF_DATA" Align="Center" Width="130"
                               />
                                   
                                    <ext:Column ID="Column35" runat="server" Text="Last Updated" DataIndex="LAST_UPDATED" Width="150" Align="Center"
                                >
                                  <Renderer Fn="TrimText" /></ext:Column>
                                   
                               
                                 
                                  
                          
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:CellSelectionModel ID="CellSelectionModel22" runat="server" />
                    </SelectionModel>
                    <View>
                        <ext:GridView ID="GridView33" runat="server" >
                        
                             <Listeners>
                                        <Refresh Handler="#{DBTable}.body.unmask();"  />
                                    </Listeners>
                        </ext:GridView>
                    </View>
                  <%--  <Buttons>
                    
                   <ext:Button ID="GoBacktoInstance" runat="server" Icon="ArrowLeft" Text="Back to Instance View">
                   <DirectEvents>
                                        <Click OnEvent="goBacktoInstanceView">
                                          
                                        </Click>
                                    </DirectEvents>
                   
                   </ext:Button>
                    </Buttons>--%>
                   
                </ext:GridPanel>

     protected void ExportToExcel(object sender, StoreSubmitDataEventArgs e)
            {
               
              
    
                  XmlNode xml = e.Xml;  // ********** Here is where the exception occurs ( screenshot attached)
    
    }
    Attached Thumbnails Click image for larger version. 

Name:	Exception.png 
Views:	25 
Size:	30.4 KB 
ID:	10031   Click image for larger version. 

Name:	BigInteger.png 
Views:	38 
Size:	60.4 KB 
ID:	10041  
    Last edited by Daniil; May 06, 2014 at 8:06 AM. Reason: [CLOSED]
  2. #2
    Hi, Can any one pls reply to this thread , asap ?
    Thanks again !!
    Last edited by geoffrey.mcgill; May 01, 2014 at 11:35 AM.
  3. #3
    Any chance you could provide a runnable sample that is simplified down to just the minimum required to reproduce the problem? I tried testing your sample, but there's errors and exceptions being thrown.

    You can review the following Guidelines for information regarding posting in the forums:

    http://forums.ext.net/showthread.php...ing-New-Topics

    http://forums.ext.net/showthread.php...ation-Required
    Geoffrey McGill
    Founder
  4. #4
    Hi, sorry for the delay !


    Here is the working example:
    -----------------------------------


    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
    
                var data = Ext.Net.JSON.Deserialize("[{\"Price\":15742093903505360896.00}"
                    );
                
              
    
                this.Store1.LoadData(data);
            }
        }
    
        protected void ExportToExcel(object sender, StoreSubmitDataEventArgs e)
        {        
            
    
          System.Xml.XmlNode n =  e.Xml;
    
    
          System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
    
    
    //        Create XmlDoc Object
              xmldoc.LoadXml(n.InnerXml);
    
      //      Create XML Stream 
              var xmlReader = new System.Xml.XmlNodeReader(xmldoc);
    
        }
    </script>
    
    <script type="text/javascript" >
    
        var SubmitValue = function () 
        {
    
          
    
            var grid;
    
            grid = Ext.getCmp("GridPanel1");
    
    
            grid.submitData(false, { isUpload: true });
        }
    </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></title>
    </head>
    <body>
      <form id="Form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server"/>
                <ext:GridPanel ID="GridPanel1" 
                runat="server"
                Title="Employees" 
                Frame="true"
                Height="300">
                <Store>
                    <ext:Store ID="Store1" runat="server" AutoLoad="false" OnSubmitData="ExportToExcel">
                        <Model>
                            <ext:Model ID="Model1" runat="server">
                                <Fields>
                                   
                                    <ext:ModelField Name="Price" Type="Float" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                   
                                            <ext:Column ID="Column2" runat="server" Text="Price" DataIndex="Price" Width="70" Align="right" />
                    </Columns>
                </ColumnModel>                   
            </ext:GridPanel>
    
    
             <ext:Button ID="btnExportInstances" runat="server" Text="Export" Cls="my-button-style" 
                                 IconUrl="/OperationalControls/Resources/img/Excel.png"  
                                 >
                                  <Listeners>
                                    <Click Handler="SubmitValue();" >
    
                                   
                                    </Click>
                                </Listeners>
    
                            
                                 </ext:Button>
    
    
            </form>
    
    </body>
    </html>
    Last edited by geoffrey.mcgill; May 01, 2014 at 11:36 AM.
  5. #5
    Unfortunately, we cannot fix it because problem inside Newtonsoft serializer
    Do you really need XML?

    I suggest to deserialize to Dictionary object, after that you can use it as required
    List<Dictionary<string, object>> dict = e.Object<Dictionary<string, object>>();
    var price = dict[0]["Price"];

Similar Threads

  1. Replies: 7
    Last Post: Oct 15, 2013, 12:35 PM
  2. [CLOSED] Exception of type 'System.OutOfMemoryException' was thrown
    By otouri in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Dec 21, 2012, 3:05 PM
  3. [CLOSED] Unsupported type: System.Guid (Migration from 0.8.3 to 1.0)
    By vedagopal2004 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 07, 2011, 9:16 AM
  4. Replies: 4
    Last Post: Feb 01, 2011, 12:54 PM
  5. Replies: 2
    Last Post: Aug 31, 2009, 7:03 PM

Posting Permissions