Skip navigation
Currently Being Moderated

Extending Dreamweaver CS4 & CS5.5 for ASP.NET MVC 3 RAZOR View

Mar 20, 2012 7:30 AM

Tags: #cs4 #cs5.5 #dreamweaver #view #3 #4.0 #extension #asp.net #engine #razor #cshtml #mvc

I know its probably a rather advance question, I'm currently a senior web developer in my company, and part of my job includes constantly looking for ways to help the company look for more innovative ways to improve the team's productivity.

 

We are currently adopting the ASP.NET 4.0 MVC 3 technology on to some of our projects, and I'm the one whose responsible for sourcing for a solution to allow the designers to edit and view the RAZOR View Engine files (.cshtml & .vbhtml) within Dreamweaver CS4 & CS5.5.

 

For now, most of the development team still works in .cshtml, so I like to start from here.

 

I have gone through briefly, the Dreamweaver CS5 Extending PDF file from Adobe's help. And I found 2 things that might be relevant, although I'm not exactly sure if I am on the right path. I think I should create extension for:

 

1. Tag Libraries & Editor - Thought this will help me to cater for the .cshtml file type that is generated from ASP.NET MVC 3's RAZOR View Engine.

2. Server Models - For recognizing coding for RAZOR View Engine. Particularly the "@" character used in RAZOR View Engine.

 

Please let me know if this is correct.

 

In the near future, we will like to further improve the Extension(s) to cater for intellisense for RAZOR View Engine coding within Dreamweaver as well. And some of the conditional statements, like for loop, if...else, etc are still being used in the RAZOR View Engine. So, it probably can leverage on some of the intellisense used in ASP.NET files.

 
Replies
  • Currently Being Moderated
    Mar 29, 2012 1:51 PM   in reply to Sherman4Christ

    I'm in the exact same situation and while I don't have the answer, maybe we can put out heads together and come up with a solution that we can share with the Dreamweaver community.

     

    The first thing I tried was working with Tags.xml. That seems to be a dead end since it seems to require a closing tag.

     

    Now I'm working with Data Translators but I can't get even a simple example to work properly.

     

    My simple example (below) is supposed to replace the tag "<bob />" with "<p>Translated</p>," surrounded by a lock. The code is run and my alert shows that my string.replace is doing its job. However, my <bob /> tag is unmodified in Code View and Design View.

     

    The translation doesn't depend on a file (depFiles attribute). I tried leaving it empty and tried giving it a file. Neither makes a difference.

     

    Perhaps I need to create a PropertyInspector, even though I have no use for it.

     

    I am stuck and maybe you or one of the Dreamweaver Extension forum regulars can get me over this hurdle.

     

    Jeff

     

    ------------------------------

     

    function getTranslatorInfo() {

        //Create a new array with 6 slots in it

        returnArray = new Array(6);

     

        returnArray[0] = "RAZOR_MARKUP";               // The translatorClass

        returnArray[1] = "Razor Markup";               // The title

        returnArray[2] = "0";                          // The number of extensions

        returnArray[3] = "1";                          // The number of expressions

        returnArray[4] = "<bob/>";                          // Expression

        //returnArray[4] = "@";                          // Expression

        returnArray[5] = "byExpression";               // run if the file contains "@"

        return returnArray;

    }

     

    function translateMarkup(docNameStr, siteRootStr, inStr) {

        alert(inStr.replace(/<bob \/>/g, "<MM:BeginLock translatorClass=\"RAZOR_MARKUP\" type=\"bob\" depFiles=\"\" orig=\"%3Cbob /%3E\"><p>Translated</p><MM:EndLock>"));

        return inStr.replace(/<bob \/>/g, "<MM:BeginLock translatorClass=\"RAZOR_MARKUP\" type=\"bob\" depFiles=\"\" orig=\"%3Cbob /%3E\"><p>Translated</p><MM:EndLock>");

    }

     

    Message was edited by: JeffLawlorEtna. Fixed a broken link.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points