I like the html dominated structure of the sparkviewengine very much.
Is there a version of it for WebForms projects?
I want to use it for generating presentation only html (I mean, the output will not contain any html input controls).
Or can you recommend an alternative?
VS.Net 2010 Framework 4.0
thanks for your time
Unfortunately, traditional ASP.NET WebForms does not allow the developer to switch out View Engines. There is only one and that's WebForms. Only with ASP.NET MVC did this concept of interchangeable view engines come about which gave you the option.
If the View Engine in traditional ASP.NET was switchable, then you would have been able to use the Spark view engine because it already understands the <%=blah %> syntax and delegates that rendering, but I'm afraid the extensibility points are just not there...
Update
I stumbled across this blog post which talks about using Spark on the WebForms project - you may have some luck following up on that...
Hope that helps,
Rob
Related
Firstly, I have only recently tried my hand at building with razor in cshtml using Webmatrix and I found it much less time consuming than building aspx web forms. Having gotten used to it, I can now do all the things I used to do inside my aspx projects much quicker and with much less code...
Now, I've spent today looking around google etc at companies using cshtml, what they're using it for etc, but I can't find a large range of examples out there. Maybe I was just looking in the wrong place, rendering this question title incorrect, but I just had a feeling that there is a reason why companies are still using aspx over cshtml.
I'm about to start a project next month for a big client and I can't decide whether to take the step of building it this way (they need a custom blog, login area etc). Any thoughts? The only other stack thread I found of any use with regards to a debate was: Razor/CSHTML - Any Benefit over what we have?
Thanks,
Adam
A lot of it has to do with ASP (classic) has been around a lot longer and (depending the project size) a migration can incur too much cost.
There's also considerations like:
What does the current web staff know (what are they fluent in?)
What libraries (proprietary or otherwise) are already dependent on ASP (including custom controls).
How much of an SEO hit are you going to take converting (some sites can mimic classic aspx page suffixes by just changing the way the routes behaving but are in-fact using cshtml).
There isn't a compelling reason for experienced ASP.NET developers to move from Web Forms or MVC to Web Pages (Razor). As a framework, it is designed to attract those who might find Web Forms or MVC too much of a learning curve. Those coming from Classic ASP or PHP, for example.
I answer a lot of questions on the Web Pages framework over at the ASP.NET forums, and I have definitely seen an increase in the number of people trying the framework out. In terms of functionality and security, you have the whole ASP.NET framework behind you so you can do anything with Web Pages that you can do with MVC or Web Forms - a lot of it more easily.
The Web Pages framework is not designed with testability in mind, and it may be more difficult for teams to organise since a certain amount of server-logic is embedded in the same file as HTML.
If you are a lone developer and happy using Web Pages, go for it.
There been a lot of discussion about the topic. Its just opinions, right tool for the right job. Please look into the following for opinions & answers:
MVC 3 ASPX VS RAZOR View Engine
Razor vs Webforms view engine for new ASP.NET MVC 3 site
What is the difference between Razor and ASPX?
Hope this helps
I have been working for 4 years as a PHP developer and I'm currently transferring to ASP.NET (Since I have 4 years of C# experience too, and selected PHP because of specific conditions - now I wish to use my C# knowledge and the .NET Framework is impressive).
When developing with PHP, I always use a framework - or something I've wrote myself (I'm working as a software architect...) or Zend Framework / Yii etc - the reasons is lack of classes, tools and OOP in PHP (such as MVC, ACL, Cache etc.)
When working with ASP.NET MVC 3, I see that combining the MVC framework and the general .NET framework I have many tools, and here is my point: when developing in ASP.NET, do you need to use any other framework than .NET? (just like in PHP I'm using Zend).
If so, there's any recommended frameworks?
Thanks! :)
In a .Net world, there are many options infront of you. see below popular vendors;
www.devexpress.com
www.telerik.com
www.comonentone.com
www.infragistics.com
But most of the time, asp.net is perfect itself. And when you are talking about mvc3. You can use another view engine instead of using Razor(the default one) such as spark. So, i mean that asp.net itself can be expended accroding to your needs.
And when you are working with mvc3, then you have best choice which entity framework. There is alot of support out there for this framework. So good luck in this.
Yes, there are other frameworks that you can choose to use alongside .NET MVC - but I myself haven't chosen to utilize them in any recent projects. Here are a few examples aside from what others have already pointed out:
http://www.springframework.net/
http://sparkviewengine.com/
That said, while I don't personally use frameworks like I mentioned above here in no particular order are a few tools that I have found that I have come to rely on while developing applications within ASP.net MVC:
Fluent Nhibernate - If you choose to use Nhibernate as your ORM
Ninject - Dependency Injector
AutoMapper - object - object mapper
ELMAH - error logging facility
lg4net - logging etc
Check out Telerik http://www.telerik.com/ They have some great tools like their RadGrids and specific imput textboxes that once you get used to will save a ton of time and add a lot more flexibility. Definitely worth a look.
No THE framework has everything you normally need. But the amount of tooling available is tremendous! We use asp.net 4.0 but we choose DevExpress controlls to get nice look and feel and functionality that would cost too much to build myself.
We worked with almost every component builder in the last 10 years but DevExpress is our favorite for one simple reason. Super fast support! And I agree with the above comment about Infragistics very disapointing support!
But again those vendors or other community frameworks are there too make our life even simpler. By itself THE framework can solve almost everything from THE core libraries.
Good luck switching to C# again my favorite language too!
Are there any third-party Templating Engines for Asp.net like we have smarty,savant for php ?
Spark: http://sparkviewengine.com/
Your question does not explicitly states what "breed" of ASP.NET you are using, so I guess it is most likely web forms. If this assumption is correct, I would not recommend for you to replace the default view engine. In order to make good use of the build in controls, you really want to keep the abstraction where HTML like elements can be marked runat=server and accessed from the server side code.
If you happen to use ASP.NET MVC, the picture is completely different. Here, there are lots of different view engines available - including NDjango, NHaml, Spark. If you are the type of web developer who care about the templating engines, you are likely to prefer ASP.NET MVC as a whole, and you might want to check it out before starting your next project.
I am new to the asp.net world (but not new to .net) and I have been playing around with various things to see how I want to architect a web application I am developing. In my playing around I have decided I did not want to use asp.net's controls, as I have done enough php and ruby on rails to be decently familiar with regular HTML, and a decent amount of javascript.
I see a lot of comparisons between asp.net webforms and asp.net MVC, however when ti comes down to it I am not seeing that much of a difference (and I'll admit that it's probably me missing the differences rather than them not being there). I already have coded my asp.net application using a MVC type of architecture (aspx has the view, aspx.cs has the controller code, and models are separate classes in the app_code directory).
If I do not intend to use asp.net controls and just intend to use pure html and javascript, what are the advantages of using the MVC framework? As of right now, the only one that I am seeing is routing, and I'm sure if I look more I can find easy ways to do custom routing without using the whole MVC framework.
Anyways, if anyone could go into details of asp.net webforms minus the asp controls versus mvc framework, I would be greatly appreciated.
You're going to find a number of differences and reasons to use MVC over WebForms but it's going to depend on whether those differences are important to you or your project. Routing is definitely a big advantage for MVC. Although you can implement custom routing configurations in WebForms it's significantly less intuitive.
Another big advantage is unit testing. Along with an IoC container and a mocking framework, MVC makes unit testing a cinch. It's much easier to isolate actions and behaviors with MVC and test those specifically.
A third advantage is that MVC will help reduce the spaghetti code you're going to write. If you're not planning on using any User Controls then it won't be long before you're missing the HTML helpers in MVC. The Html, Url, ViewModel, TempData, etc make working with raw HTML much easier.
The inherent validation in MVC is also impressive. It's getting better in MVC2 and now with the integration with client side validation libraries it will save you a ton of time and add a lot of functionality.
No more VIEWSTATE.
There are many others but again it depends on whether those features are important to you. Good luck with your decision!
ASP.NET MVC is built on interfaces, which makes it extensible, easy to write unit tests for, and encourages clean, loosely-coupled architecture.
If you're using 'classic' ASP.Net without using any of the server-side controls, there's not much of ASP.Net that you're using -- it's basically classic ASP with .Net instead of VBScript behind it at that point.
Giving up webcontrols is the biggest reason not to use ASP.Net MVC. If you're fine giving that up, I'd just use ASP.Net MVC and be done with it. It's got all the parts you'd need to write yourself anyway, and the parts you don't like, you don't have to use.
In my playing around I have decided I
did not want to use asp.net's
controls, as I have done enough php
and ruby on rails to be decently
familiar with regular HTML
Thats not a good reason to decide against ASP.NET controlls. The importand thing about ASP.NET is Viewstate. It allows you to use event driven programming in Webapplications. This makes a lot of things very easy and productive.
Anyway - as you know ruby on rails I guess you will pick up ASP.NET MVC pretty fast.
First up, if you use ASP.NET MVC you'll be using a supported framework that has books, online resources and hundreds of blog posts surrounding it.
Second, I suspect you need to play with ASP.NET MVC to see it's power. There is way more than WebForms in ASP.NET MVC. For many, the fact that WebForms is optional (you can use different view engines) is a major plus.
For me, the extension points, the cleaner code, and the unit-testability of everything I do are major reasons to never go back to ASP.NET "classic".
My recommendation to you is to get a decent tutorial (look for the Nerd Dinner tutorial), play with ASP.NET MVC, and find out for yourself.
Note: ASP.NET MVC is not for everyone, and if you're heavily into the post-back mechanisms in ASP.NET, or have a heavy investment in server and user controls, then you might not want to take ASP.NET MVC right now. But for your next project you should at least know what your options are.
I want to implement rich reporting features in one of our asp.net mvc based web applications. The required features in the reports are
Graphs
Charts
Grouping, sub totals, page breaking, etc
Ability to export to excel, pdf, csv and other formats
Printing Support
We are ready to purchase commercial controls(if free ones are not available). Please suggest us the best of available options.
I do not know what rich reporting packages are out there that are 100% ASP.NET MVC-driven. I've seen a few talk about MVC.
But technically, you don't need an MVC-version of reporting controls. ASP.NET MVC allows you to use standard ASP.NET functions, such as WebForms, postbacks, server controls, etc. This is easy as a drop-in-place solution because ASP.NET MVC's default Convention-over-Configuration programming checks to see if a directory or file exists first, before being routed through the controller logic.
So, if there are no Asp.Net Mvc versions of graphs and charts you like - then fear not, you can fall back to the ones you've used for your previous asp.net forms projects. Even though I recommend sticking it into a dedicated directory (i.e. /reports) to keep a clean website.
I suggest you try and use a regular web form for the reports, with graphic, charts, and any other ontrol you might need. MVC views and web forms can live in the same project, noting wrong with that. At least until you find a way to do it using a MVC view.
In my own opinion, you don't have to do everything MVC in a project, you are "allowed" to do whatever you need to do to make your application work the way you want to.
You can use the asp.net chart control which is free to download and supported with ASP.net MVC
I found this while searching for something similar.
http://www.componentsource.com/products/syncfusion-essential-studio-aspnet-mvc/index-gbp.html
I haven't used it though. There is a trial download.