We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Chart reference error

Thread ID:

Created:

Updated:

Platform:

Replies:

100359 Aug 1,2011 02:01 AM Apr 5,2018 05:45 AM ASP.NET MVC (Classic) 7
loading
Tags: Chart
Administrator [Syncfusion]
Asked On August 1, 2011 02:01 AM

Hi People,

I have added required references and code from the Sample which you have provided during installation and also used the following link for the reference.

http://help.syncfusion.com/ug_92/User%20Interface/ASP.NET%20MVC/Chart/index.html

I am getting following error.
Error 1 'Syncfusion.Mvc.Shared.ComponentFactory' does not contain a definition for 'Chart' and no extension method 'Chart' accepting a first argument of type 'Syncfusion.Mvc.Shared.ComponentFactory' could be found (are you missing a using directive or an assembly reference?)

Please find my code as an attachment also.

You can find the file at the below location.
"~/Views/BasicChartType.cshtml"




SyncfusionMvcApplication1_e79588e.rar

Administrator [Syncfusion]
Replied On August 1, 2011 05:49 AM

Hello guys,

I have resolved the above error but now I am getting some script error. Please fing my code as an attachment,

Thanks
Alok Shah



SyncfusionMvcApplication1_fd3dd8a5.rar

Administrator [Syncfusion]
Replied On August 1, 2011 08:44 AM

Can somebody tell me what is the difference between 2 below scripts?

@(new HtmlString(Html.Syncfusion().Chart("chart_Model", (Syncfusion.Mvc.Chart.MVCChartModel)ViewBag.chartModel).ToString())) -- It's working fine

and

@{
Html.Syncfusion().Chart("chart_Model", (Syncfusion.Mvc.Chart.MVCChartModel)ViewBag.chartModel);
} -- It's giving javascript error



Vijayabharathi K [Syncfusion]
Replied On August 4, 2011 01:42 AM

Hi Alok,

Thanks for using Syncfusion products.

By default, razor encodes the HTML. So, we need to use “HtmlString” to render the chart using property model in razor application and also prevent the HTML encoding. In builder model, we are using Render()(for Htmlstring) method to render the chart control. If we are not use “HtmlString” in property model, we got script error due to lack of HtmlString to renderer the control in razor application.


Regards,
Vijayabharathi



Manuel Monteagudo
Replied On August 22, 2012 09:37 PM

I'm having the first error exposed here how it was solved???

The issue with the chart reference.

 

Thanks,


Vijayabharathi K [Syncfusion]
Replied On August 23, 2012 03:17 AM

Hi Manuel,

Thanks for using Syncfusion products.

1)Chart Control

We suspect the cause of issue may be because of not adding required namespace in web.config file. Please refer the below

[Web.config]

<namespaces>

        <add namespace="System.Web.Helpers" />

        <add namespace="System.Web.Mvc" />

        <add namespace="System.Web.Mvc.Ajax" />

        <add namespace="System.Web.Mvc.Html" />

        <add namespace="System.Web.Routing" />

        <add namespace="System.Web.WebPages" />

        <add namespace="System.Drawing" />

        <add namespace="Syncfusion.Mvc.Shared" />

        <add namespace="Syncfusion.Mvc.Chart" />

        <add namespace="Syncfusion.Windows.Forms.Chart" />

        <add namespace="Syncfusion.Mvc.Tools" />

  </namespaces>

If you are using razor sample check this in web.config file available in Views folder. However we have created a simple sample. Please refer the attachment.(Sample_ChartControl)

Also, we are providing Syncfusion project template support to create sample in MVC platform. Please refer the following steps to create a simple chart sample by using template,

1)Open VS2010

2)Choose File->New->Project->New Project dialog opened(Refer projectdialog.png)

3)Choose Syncfusion MVC from this dialog and select Razor MVC3 sample (Refer Projectdialog.png)

4) Select Chart from Syncfusion Wizard and click “Next” button from wizard (Refer SynnWizard.png)

5) Select Theme if you set for control and then click “Done” button from wizard

The chart assemblies and namespace information added in web config files.

2)ChartAdv( Html5 control)

We have created a simple sample for ChartAdv control in MVC platform. Please refer the attachments for this sample(Sample_ChartAdv)

The following steps to create a simple application with ChartAdv control.

1)Create new MVC3 Razor application(Sample_ChartAdv) in VS2010

2) Added below reference assembly in Sample_ChartAdv application

· Syncfusion.Core,

· Syncfusion.Chart.Mvc

· Syncfusion.Shared.Mvc

3) Added code in web config for above assembly and namespace(Refer screenshot webconfig)

4) Added Resource registration to an application (Refer screenshot Layout)

5)Added code for ChartAdv control in view and controller page.

Note: We must add “Syncfusion.Mvc.ChartAdv” namespace in webconfig file for ChartAdv control. Also, we have no separate option to choose ChartAdv(HTML5) from Syncfusion project Template.

Please let us know if any concerns.

Regards,

Vijayabahrathi



Sample_f2000649.zip

james
Replied On April 4, 2018 11:48 AM

Hi Alok,

Thanks for using Syncfusion products.

By default, razor encodes the HTML. So, we need to use “HtmlString” to render the chart using property model in razor application and also prevent the HTML encoding. In builder model, we are using Render()(for Htmlstring) method to render the chart control. If we are not use “HtmlString” in property model, we got script error due to lack of HtmlString to renderer the control in razor application.


Regards,
Vijayabharathi



ozone5000@yahoo.com

Sanjith Kesavan [Syncfusion]
Replied On April 5, 2018 05:45 AM

Hi James, 

Since your query is not clear, please provide more details about your requirement. This would be helpful for us to provide the solution as per your requirement.  

Thanks, 
Sanjith. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;