I am thinking about using on of the technologies mentioned in the title but I can't decide which one would be the best for me. I jsut looked at asp.net to get an idea of each technology but I think I need a mix of MVC and WebForms, so that is why I am asking..
I want the MVC structure in the app itself and in the URLs
I want easily create a gridview with paging and sorting and easily map it to an SQL Database
I want to style everything easily via CSS
After I looked at asp.net I think MVC3 would be great for me but I need this in combination with WebForms, as I saw the DataGridView Control will be the best choice for my gridview.
Does someone give me some ideas what the best might be for me ?
After a long time using PHP and HTML/JS I hate it to doe every little step and using precreated Controls I only need to map to a database and customize via css would be a great enhancement to speed development things up!
Thanks!
In my opinion you should opt for MVC 3 approach (given most of your points mentioned) combined with jQuery DataTables. This gives you a best of both worlds - a great data visualiser and all the advantages of MVC 3.
DataTables
http://datatables.net/
DataTables ASP.NET MVC 3 Tutorial on CodeProject
http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part
Additionally if you didn't want to use the jQuery Data Tables you could look into MVC 3 Web grid which is the built in DataGridView equivalent for MVC:
http://msdn.microsoft.com/en-us/magazine/hh288075.aspx
You can use MVC, with aspx, Where you can also use the webforms features that you wished for.
I know there can be a flame war about this, people would suggest different suggestions.
Go for what you want.
All of what you need is possible easily in ASP.NET MVC.
I have been given a task of creating a common Gridview component which has following features:
Paging
sorting
Filtering
The objective is to reuse the component in almost all the web pages (.aspx), so that the look and feel, layout and behaviour remains uniform across the web site.
The grid has to be lightweight, preferably ajax based. I had several thoughts in mind:
extend the current asp.net Gridview component.
Implement a very own custom solution with ajax method pulling data, rendering happens on client side using some jquery templates..etc.
I am not sure where to start with. The requirements i have been give just says that create a common Grid component so that all others in my team can re-use the same component .
Please give me insight into which way I should approach the implementation so that in future this component is scalable as well as in the near future its re-usable across the site.
The jQuery plugin datatables.net is very light weight and has all the features you need. You could use that.
No need to reinvent the wheel, there are tons of opensource and pay grids out there to do what you wnat - Check out this grid (with complete source). One of the nice features is that you can add a toolbar which you could use for your filtering.
http://jqmvcgrid.codeplex.com/
I'm a new comer to the asp.net world. I hear a lot about asp.net mvc and it's advantage over webforms about the ability to customize the markup and css. I also heard that asp.net is much easier to learn than asp.net mvc so I decided to go for asp.net and webforms. My question is: what's the level of customization a web developer/designer can get with webforms concerning the markup and css?
You can have as much customisation as you like in the html output! You can customise everything in web forms. However, with customisation brings time, effort and room for error. All of these things is what web forms is trying to save you.
However, since you are just starting out I wouldn't worry. Just make your web forms how you want and forget the customisation of output (it is much better with ASP.NET 4 anyway). In a few years when you are more experienced then worry.
If you were going to customise everything then you should have gone with ASP.NET MVC - it is one of its main arguments. But there is nothing wrong with web forms. Particularly if you are beginning with asp.net in general I'd say it is better.
Standard ASP.NET WebForms uses server controls that generate the markup for you, so the level of customization is limited to what the controls you are using provide. There are techniques that allow you to override what is rendered by the controls and thus customize the markup and also write your own controls but it requires some coding. It is possible to achieve almost complete customization of the markup but it IMHO requires more efforts than a web developer should need to put into something like this.
While it is definitely possible to have a SEO friendly, unit-testable, maintanable, standards compliant application using classic ASP.NET WebForms, the efforts it requires will be significant compared to ASP.NET MVC. But if you don't care about those things you will be able to pretty quickly develop web applications.
ASP.NET comes with a set of built in user controls - things like text areas, buttons etc. These mimic winforms in how they are supposed to work (events etc), however this is a rather leaky abstraction (you must always remember you are working with HTML and HTTP).
The user controls allow reuse and when a page is built they emit HTML - you have little control over the emitted HTML (unless you override the rendering, which kinda defeats the point), hence the perception that they are harder to customize. It is not easy to get right either and requires more work than I think is worth.
There are also different compromises in the way pages are rendered out (ids for example end up as a long string of concatenated container control names) which make MVC a better choice if you are looking for control over your HTML.
Microsoft suggests that you pick the technology based on your needs:
While ASP.NET offers rich controls and produces quick results without great control over the markup (as mentioned: it can be done but somehow beats the idea behind ASP.NET and creates a lot of additional code), it suffers from the flaws mentioned by the other posters.
In MVC, there is a limited set of "out-of-the-box" controls and you'll have to code more on your own (including clientside JavaScript) but you do have more control over the rendered markup of your controls. In addition to that, your project will generally have a clean separation of concerns which benefits (unit) testing and maintainance.
Another aspect that hasn't been mentioned yet: In ASP.NET a page undergoes the so-called "ASP.NET Lifecycle" every time the client communicates with the server. The Lifecycle consists of several events that are fired in a special (and sometimes confusing) order. Handling those event in the right order in complex web applications is one of the biggest difficulties in ASP.NET and often leads beginners to forfeit. In MVC you don't have to deal with that kind of problem.
Therefore I strongly recommend that you take a look at the ASP.NET architecture before you start to code. Here is a very basic start: http://www.asp.net/learn/videos/video-6558.aspx
Personally, I started with WebForms and am now moving to MVC after I worked with the similar MVVM pattern in Silverlight and WPF for my bachelor thesis. This kind of did it for me so that I now understand the benefits and ideas behind MVC a lot better. Once you are used to WebForms, switching won't be that easy though.
I have come across the ASP.NET ready made controls like grid, repeater... etc.
For example while dealing with GRID i remember following facts,
ASP.NET V1.1 has DataGrid with "virtual row count" which is heavily used for custom paging which is need of big sites to perform well.
ASP.NET V2.0 added the GridView with all sort of cool features but also split the DataSource parts as different component. Also "virtual row count" is not supported and for pagination to be done DataSource control is need to be used.
After all these thing i thought that ASP.NET control are not made to be used as is for the development.
Please let me know whether i am right or wrong? Also if you think i am wrong PLEASE provide inputs/links which can help me come out of this thinking of mine.
The mjority of the out-of-the-box asp.net controls are very simple, easy to use and they do that they claim to do, reliably. Many people have had issues with the GridView control, particularly with regard to preformance and size of ViewState. Performance issues have only partly been resolved through the use of AJAX.
I agree with #Neil Moss about the Repeater control. It is very flexible and it outputs what you tell it to. For grids, take a look at the JQuery plugin JQGrid. It has none of the performance issues and a lot of the powerful features of many thrid party custom grids. http://www.trirand.net/demoaspnet.aspx
Also, the ListView control is a very good alternative to the GridView as it provides many of the databinding, selection, paging, sorting, modifying features of the gridview (see here) but gives full control over the output template. Here is a good series of articles on the ListView
Although I am a strong advocate of using ASP.NET MVC, there is a considerable learning curve required to do this and the change in mindset required to work properly in the MVC way should not be underestimated.
I've never had a problem using these controls. I find that they have the same advantages and disadvantages as any set of controls - native or third party. If they do 100% of what you need them to do, then fantastic. If they don't give you 100%, and don't give you events or virtual methods to override, then you're stuck and you'd need to go back to more fundamental controls and do a little programming of your own. I always found the repeaters and lists to be very handy in that respect.
to be very short & direct, ASP.NET ready made controls are the best solution for most projects.
I’ll explain you in detail, but first, ASP.NET ready made controls are known as ASP.NET Controls Framework or ASP.NET Controls Library. I am insisting on the key phrases because, when you search google like search engines, you need to search by appropriate keywords to get better results.
There are many control libraries available on the internet and most are offering free tools too. Besides the question whether should I use it in my enterprise applications or not, you need to understand your requirement.
The first point is YES, you can absolutely use the controls in your enterprise applications, because there controls are more reliable and built by control development experts, tested by strong product testing team and are enriched with quality documentation. Note, you will also get good community support, human resources with controls knowledge, and compliance with industry standards. The best of all, you will be able to save your time on all the above factors. Some controls even gain you more advantages with its features & functionalities which you wouldn’t have even thought about.
The most important things you need to do when choosing a control
1. You need to go through their knowledgebase
2. Search relevant articles for the control you choose
3. Download evaluation version and DIY
Many good control libraries are available in the internet. I am using obout control libraries and I recommend you to go for obout. Besides quality control sets, these guys provide personal development support. Most time I can’t separate them from my internal team. Check www.obout.com for yourself.
I have read several other posts here, so i get the idea on the pro vs. cons, especially having full control over the rendered html code etc. (in MVC).
My question is regarding the UI controls: In MVC, i will have to write all UI controls myself (or the html equivalent). Now is that not going to be very difficult?
The reason why these 3rd party vendors for asp.net are there is just because of the fact that it is difficult to write UI controls for ASP.NET all by ourselves, and be able to target to all web browsers, and also that we are better off concentrating our time on the business logic rather than spending the whole lot of time writing the UI controls HTML code ourselves.
I understand that this feature gets us the full control over the final html, but is it not counter-productive to do this UI bit ourselves. If it was so easy to write them ourselves, how come these 3-rd party vendors are all living now. We could have done this all by ourselves all these years of WebForms days.
I am sure i am missing something here or being a little stupid, but please enlighten me as to what i am missing in specific regard to the UI bit being written by ourselves.
Just because i get full control over the program by writing in IL code, do we go and do that? We still use C# and things like that - So that theory of "having full control over html" - i am not bought into that idea.
Please help in getting my head around this UI bit.
Other things i understand, about the separation of concern, TDD based development possible with MVC etc.
But why would i go around writing the UI controls all by myself - it is a bit a work isn't it?
The thing is:
If you want to master in web development you have to master HTML + CSS + Javascript
And with WebForms you have to learn the WebForms way to do it, but with MVC you have the power of .Net with the freedom to generate the HTML + CSS + Javascript you want.
Here's a new rant on the subject http://www.charliedigital.com/PermaLink,guid,6dcb0333-9d70-40c7-975b-0ff4011c4661.aspx
Problem is, ASP.NET MVC is much younger product than ASP.NET. For many years 3rd party companies have been developing TONS of reusable components, and I believe that it is only a matter of time before comparable set of controls will be available for ASP.NET MVC.
If you really need very rich GUI with 3rd party controls, and you can't rewrite them in acceptable time - stick with asp.net. Altough in my opinion, MVC gives you tons of power it wouldn't be wise to spend much more time rewriting controls than you can save. If you can live without controls, and like MVC concepts - use MVC, and you'll most certainly see 3rd party solutions as soon as they'll there is growing market (maybe thay've already noticed that, I don't know) for mvc extensions.
I believe that the UI and the user experience are vital to the success of a web app. Making the page intuitive and easy to use, minimizing the amount of navigation the user has to do to get the job done, and providing effective feedback and interactivity can make all the difference between a site that users want to use and one that they avoid.
If you are trying to attract users on a public website, a pleasing appearance and excellent usability are key to building repeat visits.
If you are writing an intranet app to be used by hundreds or thousands of employees all day long -- as I mostly do -- making the UI efficient and easy to use really means a lot to your users.
So, I wouldn't downplay the importance of the UI. It isn't a nuisance. It's a key part of the user experience. I suggest that a web developer should embrace whatever tools and strategies that will get the job done. That often means coding the UI controls yourself. Or working with a teammate who likes doing that part of the work.
I recently refactored a very complex website using ASP.NET + handworked javascript to MVC + jQuery. The complexity of the code was reduced by 50%-75% and became much more testable. I replaced all the complex webcontrols I had to write (with a steep learning curve I had to overcome) with very simple HtmlHelper methods.
Don't forget, when you use custom webcontrols, you are given a very static UI by the control developer. With raw HTML, you can take advantage of styles and ui developed by the whole web industry.
Increased simplicity, decreased development time, testability, flexibility in UI... I don't want to go back.
You also have to remember that ASP.NET MVC is just the first release. I don't think there is intrinsically any reason why you couldn't have the equivalent of server controls to enable certain tasks - remember, there are many server controls that don't generate any mark-up (such as the Repeater, PlaceHolder, ListView). These type of controls could be useful in a future MVC setting, I think.
I believe that ASP.net came around when lots of developers were still used to doing desktop applications and just beginning web development. AT that point in time abstracting the details of the web with controls and post backs was a great way to get people started. At that point we weren't trying to perfect the web, we just wanted to get on it!
Now that the web has matured and we've all slowly learned about html, css, javascript and the likes we want to optimize our websites for our own needs and we don't want to depend on ASP.net Forms controls to control the fine details of our websites.
In summary, I think this is about the natural evolution of many developers from the desktop to the web
I for one, am very thankful that you cannot use ASP.NET controls in MVC.
Controls, as many have already pointed out, are just server side blocks of code that render HTML and javascript on your behalf. Things like a datagrid are great, until someone asks you to make a slight modification, like having a delete confirmation alert, and then it seems impossible to do certain tasks.
The good news is that there are very powerful jQuery tools written to help you. jQgrid is a great grid replacement that does WAY more than the ASP.NET grid...
http://www.trirand.com/blog/
jsTree is a treeview that is fantastic. Again with the jQuery....
http://www.jstree.com/
And the truth is that most things you can do with razor, HTML, javascript and CSS. It's so simple that it's just stupid.
It's hard for people like myself who were web forms developers to grasp MVC and why you should use it because it's so simple. It's difficult to let go of the complexity of conventional ASP.NET. But it feels so good when you do.
And don't mix web forms with MVC. You can do it, but you will wish you hadn't.
Here is the key thing that I think you are missing. When ASP.NET is no longer the MS way of doing things...you will eventually be forced to move on and do something else. I have programmed in perl, ASP classic, then ColdFusion, then PHP, then ASP.NET web forms, then ASP.NET MVC...the only thing that they all have in common is the underlying database, design patterns, best practices for a given set of technology AND...HTML, JavaScript, CSS, and Photoshop.
No one is asking you to learn MVC. No one is telling you to not use WebForms. However, complaining that you have to write a raw UI is not going to get you very far in this industry. You should be learning something new every day...and it sounds like some time spent on HTML and CSS would be a great place to start your focus!
The biggest problem you have with relying on third party controls is when a client asks you to do something that the third party controls don't cover. If you can't replicate their complexity plus the added feature request on your own you are skirting a possible failure in your professional livelihood! You will need to know how to do it all...eventually!
I generally suggest that you embrace new technologies. You don't have to use them...but you should at least know how. This way you will know what the best tool is for any given project.
I've been wondering - what's an equivalent of 'control' from webforms in asp.net mvc? It's not a partial view for sure. What else it can be? Controller + partial views via partial requests?
Maybe i'm dumb, blind or both, but i haven't seen any 'control' for asp.net mvc. Just a lot of code snippets to accomplish one specific thing or another.
I believe that asp.net mvc is quite unfriendly with rapid development. Only way out of this problem - a lot of open source code (like MvcContrib), tutorials, sample applications & most important - slightly smarter developers.
You do not have to replace Webforms controls with something else from MVC. Just mix them - http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx
Well, I was also wondering how to use 3rd party controls in ASP.NET MVC. Obviously, and contrary to some answers here, it had to be possible.
As much time has passed since the question was asked, the industry has evolved. So I've searched and found (but havent' yet tested) solutions such as Telerik Extensions for ASP.NET MVC .
I'm posting this answer here mainly to support other MVC newbees such as myself - Just Google
"asp.net mvc" controls