Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Awesomeness - continuing the asp.net / razor saga

Awesomeness - continuing the asp.net / razor saga

Scheduled Pinned Locked Moved The Lounge
rubycssasp-netcsharpjavascript
16 Posts 8 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Richard DeemingR Richard Deeming

    Andy Brummer wrote:

    I might move to grunt at some point.

    This[^] might be useful, then. :)


    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

    A Offline
    A Offline
    Andy Brummer
    wrote on last edited by
    #7

    Thanks, that's one of the things that made me consider it. I use grunt for a number of tasks when I do wordpress development, and I've had less problems with it than I have with Visual Studio and nuget. The simple fact that nuget needs a -safe switch says volumes.

    Curvature of the Mind now with 3D

    1 Reply Last reply
    0
    • M Marc Clifton

      Continuing the tale of my diving into ASP.NET Razor for this Department of Public Works project... jQuery is awesome Mike Brind[^] is awesome. His articles on Razor and inline grid editor, even though they are for MVC 3, were invaluable. Got a full inline editing WebGrid up and running with add and delete row capability, all using jQuery's post and ajax functions, and using MVC 4. (I hope MVC 5 doesn't have such annoying breaking changes.) Speaking of which AJAX is cool. I come from a background of maintaining an older Ruby on Rails app where everything requires a page refresh. Yuck. It is really really cool to be doing posts/gets to the server without having to reload the page. C# / Razor is great. Ah, what a relief not to be working in RoR and using some "real" tools. I also signed up for a really cheap web hosting service, we'll see how it goes before I give it a thumbs up/down indicator. Also, after reading about how AngularJS 2.0 is a complete rewrite with no migration path from version 1.3, I've decided not to use it. For what I need, it looks like I might use a wee bit of knockout, but we'll see -- it may be that jQuery can handle all the functionality that I require. One thing that's slightly annoying is that the view engine is so rigid. I really did love working with Slim/SASS in RoR, and it's unfortunate that the rendering engine can't be easily replaced. I also find it interesting how easy it is to absolutely ignore the whole "model" part of MVC. Mike's examples use code embedded in the cshtml which as a certain convenience but which I don't like. That means then, if I put the C# code into the controller, I have to make the data available either through a ViewBag (which is where my learning curve is now) or a model (which I'll be migrating the code to next to learn the ins & outs of that. And while Razor is great and the Html control wrappers are cool, it's really pathetic how to do anything user-friendly, you're pretty much coding in raw HTML. Oh, and I hate style sheets. I want an editor that, when I mouse over a tag in the cshtml, it tells me what all the styles are that are being applied and allows me to click on the style so I can edit it in the css file. I thought I saw something like that somewhere once. But I'm quite happy. Two days of concentrated effort have resulted in a grid that with a little polish will become a reu

      B Offline
      B Offline
      Bob Nadler
      wrote on last edited by
      #8

      +1 for knockout -- easy to learn and use. Like angular, it can be applied to the DOM selectively so you can start out small. IMHO the well argued catch-phrase "JavaScript is the Assembly Language of the Web" is mostly correct. CSS should also be included. The JS/CSS chaos is of course what's spawning all of these compilers, frameworks, and tools. The evolution of these higher level abstractions is still in its infancy (think fish with feet) so the ride is going to be rough for a while.

      Bob on Medical Device Software [^]

      1 Reply Last reply
      0
      • M Marc Clifton

        Continuing the tale of my diving into ASP.NET Razor for this Department of Public Works project... jQuery is awesome Mike Brind[^] is awesome. His articles on Razor and inline grid editor, even though they are for MVC 3, were invaluable. Got a full inline editing WebGrid up and running with add and delete row capability, all using jQuery's post and ajax functions, and using MVC 4. (I hope MVC 5 doesn't have such annoying breaking changes.) Speaking of which AJAX is cool. I come from a background of maintaining an older Ruby on Rails app where everything requires a page refresh. Yuck. It is really really cool to be doing posts/gets to the server without having to reload the page. C# / Razor is great. Ah, what a relief not to be working in RoR and using some "real" tools. I also signed up for a really cheap web hosting service, we'll see how it goes before I give it a thumbs up/down indicator. Also, after reading about how AngularJS 2.0 is a complete rewrite with no migration path from version 1.3, I've decided not to use it. For what I need, it looks like I might use a wee bit of knockout, but we'll see -- it may be that jQuery can handle all the functionality that I require. One thing that's slightly annoying is that the view engine is so rigid. I really did love working with Slim/SASS in RoR, and it's unfortunate that the rendering engine can't be easily replaced. I also find it interesting how easy it is to absolutely ignore the whole "model" part of MVC. Mike's examples use code embedded in the cshtml which as a certain convenience but which I don't like. That means then, if I put the C# code into the controller, I have to make the data available either through a ViewBag (which is where my learning curve is now) or a model (which I'll be migrating the code to next to learn the ins & outs of that. And while Razor is great and the Html control wrappers are cool, it's really pathetic how to do anything user-friendly, you're pretty much coding in raw HTML. Oh, and I hate style sheets. I want an editor that, when I mouse over a tag in the cshtml, it tells me what all the styles are that are being applied and allows me to click on the style so I can edit it in the css file. I thought I saw something like that somewhere once. But I'm quite happy. Two days of concentrated effort have resulted in a grid that with a little polish will become a reu

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #9

        Using knockout and web API I found I could ignore the controller (as in view controller) part of MVC as well. Who needs loads of view controllers with actions that just return the relevant view? You just need to tweak the HTTP handler so it's a bit smarter https://github.com/brentj73/ControllerLess[^]

        How do you know so much about swallows? Well, you have to know these things when you're a king, you know.

        M 1 Reply Last reply
        0
        • M Marc Clifton

          Continuing the tale of my diving into ASP.NET Razor for this Department of Public Works project... jQuery is awesome Mike Brind[^] is awesome. His articles on Razor and inline grid editor, even though they are for MVC 3, were invaluable. Got a full inline editing WebGrid up and running with add and delete row capability, all using jQuery's post and ajax functions, and using MVC 4. (I hope MVC 5 doesn't have such annoying breaking changes.) Speaking of which AJAX is cool. I come from a background of maintaining an older Ruby on Rails app where everything requires a page refresh. Yuck. It is really really cool to be doing posts/gets to the server without having to reload the page. C# / Razor is great. Ah, what a relief not to be working in RoR and using some "real" tools. I also signed up for a really cheap web hosting service, we'll see how it goes before I give it a thumbs up/down indicator. Also, after reading about how AngularJS 2.0 is a complete rewrite with no migration path from version 1.3, I've decided not to use it. For what I need, it looks like I might use a wee bit of knockout, but we'll see -- it may be that jQuery can handle all the functionality that I require. One thing that's slightly annoying is that the view engine is so rigid. I really did love working with Slim/SASS in RoR, and it's unfortunate that the rendering engine can't be easily replaced. I also find it interesting how easy it is to absolutely ignore the whole "model" part of MVC. Mike's examples use code embedded in the cshtml which as a certain convenience but which I don't like. That means then, if I put the C# code into the controller, I have to make the data available either through a ViewBag (which is where my learning curve is now) or a model (which I'll be migrating the code to next to learn the ins & outs of that. And while Razor is great and the Html control wrappers are cool, it's really pathetic how to do anything user-friendly, you're pretty much coding in raw HTML. Oh, and I hate style sheets. I want an editor that, when I mouse over a tag in the cshtml, it tells me what all the styles are that are being applied and allows me to click on the style so I can edit it in the css file. I thought I saw something like that somewhere once. But I'm quite happy. Two days of concentrated effort have resulted in a grid that with a little polish will become a reu

          F Offline
          F Offline
          Fabio Franco
          wrote on last edited by
          #10

          Marc Clifton wrote:

          It is really really cool to be doing posts/gets to the server without having to reload the page.

          If You didn't get there yet, you will see the delight it is to render partial views. Which is a combination of Razor+CodeBehind easy way of rendering and AJAX, without having to deal with Javascript. blockquote class="quote">

          Marc Clifton wrote:

          One thing that's slightly annoying is that the view engine is so rigid. Could you elaborate on that? My perception is that the view engine is anything but rigid.

          Marc Clifton wrote:

          I have to make the data available either through a ViewBag (which is where my learning curve is now) or a model (which I'll be migrating the code to next to learn the ins & outs of that.

          Basically when you use the model instead of the ViewBag, you get a strongly typed view, which can make the view much more maintainable and not error prone. As the model is class, you can also add some behavior to your view models.

          Marc Clifton wrote:

          you're pretty much coding in raw HTML.

          I find that an advantage. In my case it not only forced me to really learn HTML, but it also makes it much easier to work on cross-browser bugs as you're in complete control. And in the end, HTML is actually the base for the web, so I think we are back where we should never have left.

          Marc Clifton wrote:

          But I'm quite happy.

          Awesome, I'm happy for you.

          Marc Clifton wrote:

          Two days of concentrated effort have resulted in a grid that with a little polish will become a reusable mainstay component of this project.

          You should consider jqGrid[^], it saves a lot of time, after you customizes it once. It also deals beautifully with paging. Happy coding :)

          To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

          M 1 Reply Last reply
          0
          • F Fabio Franco

            Marc Clifton wrote:

            It is really really cool to be doing posts/gets to the server without having to reload the page.

            If You didn't get there yet, you will see the delight it is to render partial views. Which is a combination of Razor+CodeBehind easy way of rendering and AJAX, without having to deal with Javascript. blockquote class="quote">

            Marc Clifton wrote:

            One thing that's slightly annoying is that the view engine is so rigid. Could you elaborate on that? My perception is that the view engine is anything but rigid.

            Marc Clifton wrote:

            I have to make the data available either through a ViewBag (which is where my learning curve is now) or a model (which I'll be migrating the code to next to learn the ins & outs of that.

            Basically when you use the model instead of the ViewBag, you get a strongly typed view, which can make the view much more maintainable and not error prone. As the model is class, you can also add some behavior to your view models.

            Marc Clifton wrote:

            you're pretty much coding in raw HTML.

            I find that an advantage. In my case it not only forced me to really learn HTML, but it also makes it much easier to work on cross-browser bugs as you're in complete control. And in the end, HTML is actually the base for the web, so I think we are back where we should never have left.

            Marc Clifton wrote:

            But I'm quite happy.

            Awesome, I'm happy for you.

            Marc Clifton wrote:

            Two days of concentrated effort have resulted in a grid that with a little polish will become a reusable mainstay component of this project.

            You should consider jqGrid[^], it saves a lot of time, after you customizes it once. It also deals beautifully with paging. Happy coding :)

            To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

            M Offline
            M Offline
            Marc Clifton
            wrote on last edited by
            #11

            Fabio Franco wrote:

            You should consider jqGrid[^],

            jqGrid looks pretty good. Horrid website though. Why the authors feel that a transparent roll-over for showing enlarged screenshots is actually readable is beyond me. Somebody was definitely smoking something when they were playing with the opacity setting. X| I'll look into partial views. Regarding the view engine, what I would like to do is work with Slim and SASS for lightweight HTML and CSS, but that doesn't seem possible with Razor. I'm exploring the usefulness of models. Actually, truth be told, I'm exploring the usefulness of the whole MVC concept. It's beginning to strike me as a lot of unnecessary baggage. What I'm leaning toward is a framework that just lets me wire up a method to handle the post/get/etc., otherwise, gets the f*** out of the way. I'm still evaluating whether the built in security stuff (roles, etc), "authorize" attribute, is implemented in a useable way. I suspect not. Marc

            Imperative to Functional Programming Succinctly Higher Order Programming

            F 1 Reply Last reply
            0
            • L Lost User

              Using knockout and web API I found I could ignore the controller (as in view controller) part of MVC as well. Who needs loads of view controllers with actions that just return the relevant view? You just need to tweak the HTTP handler so it's a bit smarter https://github.com/brentj73/ControllerLess[^]

              How do you know so much about swallows? Well, you have to know these things when you're a king, you know.

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #12

              Brent Jenkins wrote:

              Who needs loads of view controllers with actions that just return the relevant view?

              Exactly. I'm also not quite "getting it" with the whole model thing, other than the model giving you strongly typed fields, which is only marginally useful while in the C# paradigm, of which, when I look at the cshtml file, is maybe 10% of the entire markup. The rest is HTML and jQuery and working with JSON structures. ControllerLess looks great - thanks for pointing that out. Marc

              Imperative to Functional Programming Succinctly Higher Order Programming

              1 Reply Last reply
              0
              • M Marc Clifton

                Fabio Franco wrote:

                You should consider jqGrid[^],

                jqGrid looks pretty good. Horrid website though. Why the authors feel that a transparent roll-over for showing enlarged screenshots is actually readable is beyond me. Somebody was definitely smoking something when they were playing with the opacity setting. X| I'll look into partial views. Regarding the view engine, what I would like to do is work with Slim and SASS for lightweight HTML and CSS, but that doesn't seem possible with Razor. I'm exploring the usefulness of models. Actually, truth be told, I'm exploring the usefulness of the whole MVC concept. It's beginning to strike me as a lot of unnecessary baggage. What I'm leaning toward is a framework that just lets me wire up a method to handle the post/get/etc., otherwise, gets the f*** out of the way. I'm still evaluating whether the built in security stuff (roles, etc), "authorize" attribute, is implemented in a useable way. I suspect not. Marc

                Imperative to Functional Programming Succinctly Higher Order Programming

                F Offline
                F Offline
                Fabio Franco
                wrote on last edited by
                #13

                Marc Clifton wrote:

                Somebody was definitely smoking something when they were playing with the opacity setting. X|

                Yeah... developers... :laugh:

                Marc Clifton wrote:

                I would like to do is work with Slim and SASS for lightweight HTML and CSS, but that doesn't seem possible with Razor.

                I never worked with SASS, so I can't give you a definite answer for this, but whatever is supported on pure html, css applications, should be supported with Razor. I never found Razor to limit what you can already do purely in HTML or CSS. You can see Razor as a helper to build dynamic HTML and CSS with less effort.

                Marc Clifton wrote:

                I'm still evaluating whether the built in security stuff (roles, etc), "authorize" attribute, is implemented in a useable way.

                Actually it is.Right out of the box you can use the AuthorizeAttribute to restrict access on entire views or actions by decorating them with no other programming required. AuthorizeAttribute will check if the user is logged in to decide wether to serve the Action/View. AllowAnonymous works the same way. For example, you can decorate the class the represents the controller with Authorize , which will make all of its actions require authentication. Later you can decorate one of the actions with Anonymous as an exception for the controller rule. All of this makes a very safe way to restrict access, even to AJAX calls. Using roles will require a little bit of customization to match the roles of your application specifically. In any case, it hardly requires a lot of work and can save you a a lot of time implementing security.

                To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                M 1 Reply Last reply
                0
                • F Fabio Franco

                  Marc Clifton wrote:

                  Somebody was definitely smoking something when they were playing with the opacity setting. X|

                  Yeah... developers... :laugh:

                  Marc Clifton wrote:

                  I would like to do is work with Slim and SASS for lightweight HTML and CSS, but that doesn't seem possible with Razor.

                  I never worked with SASS, so I can't give you a definite answer for this, but whatever is supported on pure html, css applications, should be supported with Razor. I never found Razor to limit what you can already do purely in HTML or CSS. You can see Razor as a helper to build dynamic HTML and CSS with less effort.

                  Marc Clifton wrote:

                  I'm still evaluating whether the built in security stuff (roles, etc), "authorize" attribute, is implemented in a useable way.

                  Actually it is.Right out of the box you can use the AuthorizeAttribute to restrict access on entire views or actions by decorating them with no other programming required. AuthorizeAttribute will check if the user is logged in to decide wether to serve the Action/View. AllowAnonymous works the same way. For example, you can decorate the class the represents the controller with Authorize , which will make all of its actions require authentication. Later you can decorate one of the actions with Anonymous as an exception for the controller rule. All of this makes a very safe way to restrict access, even to AJAX calls. Using roles will require a little bit of customization to match the roles of your application specifically. In any case, it hardly requires a lot of work and can save you a a lot of time implementing security.

                  To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                  M Offline
                  M Offline
                  Marc Clifton
                  wrote on last edited by
                  #14

                  Fabio Franco wrote:

                  but whatever is supported on pure html, css applications, should be supported with Razor.

                  Yes, but that's the point. SASS and Slim are a non-CSS and non-HTML syntax. This is an example of Slim:

                  body
                  h1 Markup examples

                  Indentation is used to determine closing tags. SASS is like SCSS in that it makes the CSS a lot more readable, but SASS also removes extraneous braces and semicolons, again relying on indentation:

                  nav
                  ul
                  margin: 0
                  padding: 0
                  list-style: none

                  vs. straight CSS:

                  nav ul {
                  margin: 0;
                  padding: 0;
                  list-style: none;
                  }

                  I'm still poking around to see if Razor supports these options. Slim was definitely a Ruby plugin. Marc

                  Imperative to Functional Programming Succinctly Higher Order Programming

                  F A 2 Replies Last reply
                  0
                  • M Marc Clifton

                    Fabio Franco wrote:

                    but whatever is supported on pure html, css applications, should be supported with Razor.

                    Yes, but that's the point. SASS and Slim are a non-CSS and non-HTML syntax. This is an example of Slim:

                    body
                    h1 Markup examples

                    Indentation is used to determine closing tags. SASS is like SCSS in that it makes the CSS a lot more readable, but SASS also removes extraneous braces and semicolons, again relying on indentation:

                    nav
                    ul
                    margin: 0
                    padding: 0
                    list-style: none

                    vs. straight CSS:

                    nav ul {
                    margin: 0;
                    padding: 0;
                    list-style: none;
                    }

                    I'm still poking around to see if Razor supports these options. Slim was definitely a Ruby plugin. Marc

                    Imperative to Functional Programming Succinctly Higher Order Programming

                    F Offline
                    F Offline
                    Fabio Franco
                    wrote on last edited by
                    #15

                    I actually prefer the traditional syntax, maybe my C/C# background pushes me to prefer it that way. Clear definitions where anything starts or ends. This kind of syntax remembers me of Visual Basic X| .

                    Marc Clifton wrote:

                    if Razor supports these options. Slim was definitely a Ruby plugin.

                    I think that the right question should be if ASP.net supports it or if there is a Visual Studio plugin that will compile that syntax into pure CSS on build, much like it does with type script to javascript. In my experience, this should not have anything to do with the Razor rendering engine itself. Bear in mind that Razor is still compiled in the server side, although it's written in the view.

                    To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                    1 Reply Last reply
                    0
                    • M Marc Clifton

                      Fabio Franco wrote:

                      but whatever is supported on pure html, css applications, should be supported with Razor.

                      Yes, but that's the point. SASS and Slim are a non-CSS and non-HTML syntax. This is an example of Slim:

                      body
                      h1 Markup examples

                      Indentation is used to determine closing tags. SASS is like SCSS in that it makes the CSS a lot more readable, but SASS also removes extraneous braces and semicolons, again relying on indentation:

                      nav
                      ul
                      margin: 0
                      padding: 0
                      list-style: none

                      vs. straight CSS:

                      nav ul {
                      margin: 0;
                      padding: 0;
                      list-style: none;
                      }

                      I'm still poking around to see if Razor supports these options. Slim was definitely a Ruby plugin. Marc

                      Imperative to Functional Programming Succinctly Higher Order Programming

                      A Offline
                      A Offline
                      AspDotNetDev
                      wrote on last edited by
                      #16

                      MVC supports custom view engines, if you feel inclined to create one. The default is Razor. See: Creating your own MVC View Engine For MVC Application. You could, for example, create a Slim view engine. Regarding SASS, you can use that in Visual Studio with an MVC application. Web Essentials can compile it, or you can use Compass to watch for changes and automatically compile to CSS.

                      Thou mewling ill-breeding pignut!

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups