Javascript: Unterminated String Constant

7 posts, 0 answers
  1. Roland Klug
    Roland Klug avatar
    26 posts
    Member since:
    Dec 2002

    Posted 26 Oct Link to this post

    Hello,

    I'm trying to get a working RadHtmlChart. But as soon as i'm using a LinQ-DataSource, i'm getting an Javascript-Exception "0x800a03f7: Unterminated String Constant" and the Chart is empty

    Here's the Code of the .aspx:

    <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="800px" Height="500px">
              <PlotArea>
                 <Series>
                    <telerik:ColumnSeries DataFieldY="PriceVk">
                    </telerik:ColumnSeries>
                  </Series>
                <XAxis DataLabelsField="Name"></XAxis>
           </PlotArea>
    </telerik:RadHtmlChart>

     

    And this is the Code Behind:

    protected void Page_Load(object sender, EventArgs e)
            {
                var context = new StuffrulerDataContext(this.Connection);
                var data = context.StuffItems.Where(i => i.PriceVk > 0).Take(5).ToList();
                this.RadHtmlChart1.DataSource = data;
               // this.RadHtmlChart1.DataSource = GetData();
                this.RadHtmlChart1.DataBind();
     
            }
     
            protected DataTable GetData()
            {
                DataTable tbl = new DataTable();
                tbl.Columns.Add(new DataColumn("PriceVk", typeof(decimal)));
                tbl.Columns.Add(new DataColumn("Name", typeof(string)));
     
                tbl.Rows.Add(new object[] { 100, "First" });
                tbl.Rows.Add(new object[] { 200, "Second" });
                return tbl;
            }

     

    When I'm using GetData() as Source, it works fine.

     

  2. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 31 Oct Link to this post

    Hello Roland,

    I tried reproducing the issue you mentioned in the following demo, because the data source for your example is not included: http://demos.telerik.com/aspnet-ajax/htmlchart/examples/databinding/linqdatasource/defaultcs.aspx

    The data appears to be loading on the demo so the error might be related to the data you are using. If the issue can be reproduced in the demo, let me know how to change it so that I can debug it locally.

    If not, please send a fully runnable sample that isolates the problem at hand. This will allow me to reproduce it on my end and determine what happens.


    Regards,
    Slav
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Roland Klug
    Roland Klug avatar
    26 posts
    Member since:
    Dec 2002

    Posted 02 Nov in reply to Slav Link to this post

    Hello Slav,

    i found the Problem. When i juse this as DataSource:

    var data = context.StuffItems.Select(i => new { i.PriceVk, i.Name }).Where(i => i.PriceVk > 0)

     

    it works fine. As soon as i delete the Select-Part it stops working.

    I thought i was able to bind the whole DataSource and select the wanted Fields in the .aspx or in Code Behind using 

    RadHtmlChart1.PlotArea.XAxis.DataLabelsField = "Name";

     

    but it looks like this is not possible.

  5. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 07 Nov Link to this post

    Hello Roland,

    It is possible that this is a result of setting the data in the RadHtmlChart directly without using a LinqDataSource (which is the the expected setup in such scenarios).

    Nevertheless, when I try the same with the HtmlChart - LinqDataSource demo (http://demos.telerik.com/aspnet-ajax/htmlchart/examples/databinding/linqdatasource/defaultcs.aspx) and more specifically, to bind the data like this

    protected void Page_Load(object sender, System.EventArgs e)
    {
        NorthwindReadOnlyEntities northwindContext = new NorthwindReadOnlyEntities();
        RadHtmlChart1.DataSource = northwindContext.Products.Where(p => p.UnitsOnOrder > 0).Where(p => p.UnitsInStock > 0).Take(5);
    }
    it still loads them correctly.

    You can try using a LinqDataSource in order to data bind the chart control. If the same issue occurs with the data source control, you can isolate the problematic behavior in a fully runnable sample. This will allow me to debug it locally and determine why the chart cannot detect the data source field with the particular data source on your end.

     

     

    Regards,
    Slav
    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
  6. Roland Klug
    Roland Klug avatar
    26 posts
    Member since:
    Dec 2002

    Posted 23 Nov in reply to Slav Link to this post

    Hello Slav,

    i switched to a SQL-DataSource and got it working so far. But i've got a Problem when there are a lot of Results.

    With 150 Results (select TOP 150...) it works, but with 200 it stops working with the same Error Message (Javascript-Exception 0x800a03f7). When i set this Source for a RadGrid it works without any Problem.

    Is there a restriction for the amount of Results? If yes, how high is it?

  7. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 28 Nov Link to this post

    Hello Roland,

    There should not be issues with loading such amount of data in RadHtmlChart. Could you please try isolating the problem at hand in a fully runnable sample that includes the data you use? It will allow me to reproduce the issue locally and determine why it occurs.

    You can also use the attached sample to extract the data and send in, which can help me reproduce it.

    Another resource you can check is the following documentation article, which can help you optimize the performance in case the issue is performance related: http://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/troubleshooting/performance-optimizations

    Regards,
    Slav
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
  8. Roland Klug
    Roland Klug avatar
    26 posts
    Member since:
    Dec 2002

    Posted 3 days and 19 hours ago in reply to Slav Link to this post

    Hello Slav,

    i've found the Problem now. It was a quotation mark in one of the records. Thank you for your help.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017