Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Using Razore View Engine (Read 8513 times)
Martin Sher
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Mar 1st, 2013
Using Razore View Engine
Mar 1st, 2013 at 12:21pm
Print Post  
Hi

Are there any simple examples that use the Razor View Engine as all the provided samples use the ASPx view engine.

I have added a reference to Mindfusion.Diagramming.Mvc to my project but my view does not seem to recognise @Html.Mindfusion....

Any help?

Thanks
Martin
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using Razore View Engine
Reply #1 - Mar 1st, 2013 at 1:08pm
Print Post  
Hi,

Here's a small test project that uses Razor:
https://mindfusion.eu/_samples/RazorSample.zip

Note that the MindFusion namespaces are listed in web.config:

Code
Select All
<system.web.webPages.razor>
    <namespaces>
        <add namespace="MindFusion.Diagramming" />
        <add namespace="MindFusion.Drawing" />
        <add namespace="MindFusion.Diagramming.Mvc" /> 



Alternatively, you could add this to every cshtml page that needs to access the diagram API:

Code
Select All
@using MindFusion.Diagramming;
@using MindFusion.Diagramming.Mvc;
 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Martin Sher
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Mar 1st, 2013
Re: Using Razore View Engine
Reply #2 - Mar 1st, 2013 at 4:37pm
Print Post  
Thanks.
I realised that also have to add in the j script.
Martin
  
Back to top
 
IP Logged
 
mandz
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 28
Joined: Mar 12th, 2013
Re: Using Razore View Engine
Reply #3 - Mar 12th, 2013 at 3:22am
Print Post  
Any chance that I can see Razor projects for each of the 5 tutorials? I'm a WPF developer who is now learning MVC with Razor and don't follow the aspx way of working. Even better would be to have Razor examples. I'm currently only evaluating your product and am finding it hard with what you have
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using Razore View Engine
Reply #4 - Mar 12th, 2013 at 8:06am
Print Post  
Here are a few tutorials ported to Razor:
https://mindfusion.eu/_samples/RazorTutorials.zip

We'll add more Razor sample projects for next release in a few weeks.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mandz
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 28
Joined: Mar 12th, 2013
Re: Using Razore View Engine
Reply #5 - Mar 20th, 2013 at 2:27am
Print Post  
Thanks.  This helps heaps.
  
Back to top
 
IP Logged
 
mandz
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 28
Joined: Mar 12th, 2013
Re: Using Razore View Engine
Reply #6 - Apr 4th, 2013 at 12:31am
Print Post  
Thanks again for the tutorials in Razor. 

I'm now trying to use the controls in my project but can't get it to work.   This is the error I get:

Unhandled exception at line 1, column 1 in http://localhost:54891/Scripts/MindFusion.Diagramming.js

0x800a1391 - Microsoft JScript runtime error: 'Type' is undefined

I've compared the tutorial project to mine, but can't find what I'm missing. I could possibly use the tutorial project for my starting point and import all my old files into it, don't want to, because the tutorial was build with MVC3.

This is what I've done to try to make it work:

- Started an MVC 4 Web application.

- Added these lines to my web.config in the views folder:
        <add namespace="MindFusion.Diagramming" />
        <add namespace="MindFusion.Drawing" />
        <add namespace="MindFusion.Diagramming.Mvc" />

- Added MindFusion.Diagramming.js to my Scripts folder.

- Added the following 2 lines to my _Layout.cshtml file:
        <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/MindFusion.Diagramming.js")" type="text/javascript"></script>

- Added references to these dll's"
      MindFusion.Common
      MindFusion.Diagramming
      MindFusion.Diagramming.Mvc
      MindFusion.Graphs
      MindFusion.Scripting

Please let me know what else I should do to get your controls working in my project.  Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Using Razore View Engine
Reply #7 - Apr 4th, 2013 at 8:40am
Print Post  
Quote:
- Added MindFusion.Diagramming.js to my Scripts folder.


Try also adding MicrosoftAjax.js there. I think you will get that error if MicrosoftAjax.js hasn't loaded correctly, and it is no longer added by default to MVC4 projects.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
mandz
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 28
Joined: Mar 12th, 2013
Re: Using Razore View Engine
Reply #8 - Apr 4th, 2013 at 11:16pm
Print Post  
Thanks.  Its now working Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint