Tag | MVC Posts

When we were working with ASP.NET MVC 2, we needed to write our own JavaScript to get Client-Side Validation Summary with jQuery Validation plugin. I am one of those unfortunate people still stuck with .NET Framework Runtime 2.0 and .NET Framework 3.5; meaning I am still on ASP.NET MVC 2. So I will still keep on supporting by answering any question you may have with my original code. Long awaited ASP.NET MVC 3 has been released, and it supports Client Side Validation Summary with jQuery out-of-the-box ...
I have seen several posts on how to use the ASP.Net chart controls with MVC and they all involved some sort of hybrid web forms approach. I have a simple solution which is 100% MVC. Here is a summary of the process: Create an action to render the chart. Create an action to render the image map. Use a normal IMG tag to render the chart image. Use Html.RenderAction to render the image map. The most simple implementation without drill-down would look something like this: public ActionResult Chart(int? ...
I’m trying to find time to update the Prairie Developer Conference 2011 website, and the sessions and speaker information will be up by this weekend including the registration page. For those that are wondering what the session and speaker list looks like, I wanted to give a sneak peak. We have a fantastic set of sessions by world class technologists! We’re covering .NET, Java, Ruby, SQL Server, Agile, User Experience, Mobile, Security, Azure, Office, SharePoint, and others. In fact, this year I’ve ...
When Microsoft came out with C#, many embraced it instantaneously; whereas, others took some time to adopt it. Over time, the number of C# developers grew in a major way. I would not be surprised if the number C# developers have surpassed the number of VB .NET developers today. Recently, in a similar manner, we are observing the continuous growth and maturity of ASP .NET MVC. When the MVC framework first showed up, my first reaction was “it's about time”. However, I was skeptical. MVC framework is ...
Silverlight is a great product right off the shelf. I use it, love it and spend a lot of time helping the community understand it. This however, doesn’t mean that I don’t think that it can get better. If I were invited to a Microsoft Focus Group about Silverlight here is 10 things I would say: We need more navigation templates. I’ve found (4) templates that Microsoft has released (Cosmo, Windows 7, Accent and JetPack). This number needs to be around 16. In order to get more people developing for ...
Microsoft have now released Web Matrix (and ASP.NET MVC3 if you so inclined!) One signifcant utility is IIS Express which will replace Cassini It is worth noting that SP1 for VS2010 should be out in Q1. Links: http://www.hanselman.com/bl... http://www.hanselman.com/bl... http://arstechnica.com/micr... ...
The Gu and the Haack had just announced the ASP.NET MVC 3 RTM had been released yesterday. You can download the intall file, release note and source code here. As the Gu said with the ASP.NET MVC 3 there are some other productions released as well NuGet IIS Express 7.5 SQL Server CE 4 Web Deploy & Web Farm Framework 2.0 Orchard 1.0 WebMatrix 1.0 The Orchard is a CMS and blogging system which build from ASP.NET MVC 3 with the new Razor view engine which can be found here and here. Hope this helps, ...
Problem As was mentioned in a previous blog I am building a web page that allows the user to select dates in a calendar and then shows the dates in an unordered list. The problem now is that those dates need to be sent to the server on page submit so that they can be saved to the database. If I was storing the dates in an input element, say a textbox, that wouldn't be an issue but because they are in an html element whose contents are not posted to the server an alternative strategy needs to be developed. ...
Overview I recently needed to build a web page that would allow a user to capture some information and most importantly select multiple dates. This functionality was core to the application and hence had to be easy and quick to do. This is a public facing website so it had to be intuitive and very responsive. On the face of it it didn't seem too hard, I know enough juery to know what it is capable of and I was pretty sure that there would be some plugins that would help speed things along the way. ...
If you are using MVC it might be worth checking out the telerik controls (http://demos.telerik.com/a... they are free if you are doing an internal or “not for profit” application. If however you do choose to use them, you could come up against a little problem I had. Using the telerik controls with your own custom jQuery. In my case I was using the jQuery UI dialog. It kept throwing an error where I was setting my div to a dialog. Code Snippet $("#textdialog").dialog({ The problem is when ...
Goal Upgrade your MVC 1 app to MVC 2 Issues You may get errors about your Json data being returned via a GET request violating security principles - we also address this here. This post is not intended to delve into why the Json GET request is or may be an issue, just how to resolve it as part of upgrading from MVC1 to 2. Solution First remove all references from your projects to the MVC 1 dll and replace it with the MVC 2 dll. Now update your web.config file in your web app root folder by simply ...
Google now has a feature where the search updates as you type in the search box. You can implement the same feature in your MVC site with a little jQuery and MVC Ajax. Here's how: Create a javascript global variable to hold the previous value of your search box. Use setTimeout to check to see if the search box has changed after some interval. (Note: Don't use setInterval since we don't want to have to turn the timer off while Ajax is processing.) Submit the form if the value is changed. Set the update ...
I recently ran into a problem with the following scenario: I have data with a parent/child data with a one-to-many relationship from the parent to the child. I want to be able to update parent and existing child data AND add a new child record all in a single post. I don't want to create a model just to store the new values. One of the things I LOVE about MVC is how flexible it is in dealing with posted data. If you have data that isn't in your model, you can simply use the non-strongly-typed HTML ...
Just a quick one, seems pretty weird to me. I installed .net 4.0 on an old IIS6 box, ready to deploy a asp.net mvc app targeting .net 4.0. I thought, which to me seems logical, that I install .net 4.0, setup a new web site, new app pool, set the web site to asp.net 4.0 (other configuration also needed to run MVC on IIS6 here and here) and it would just work. Errr… No. The page cannot be displayed! Nothing to do with MVC. Apparently just because you have installed .net 4 and the option is available ...
Just thought I’d pass on the word that the Visual Studio 2010 Service Pack 1 Beta is now available to download. VS2010 SP1 Beta ships with a go live license which means you can start using it for production work though I’m not sure I’m going to be that brave until I check it out a bit first. Jason Zanders has a blog post outlining the new features/fixes included in the beta. Here are a couple BREAKING news items you’ll want to TakeNote of… VS2010 SP1 Beta BREAKS ASP.NET MVC 3 RC Razor IntelliSense. ...
Part 1 - Listing Data from Database: Let us now learn ASP.NET MVC 2 from Scratch by actually developing a front end website for the Chinook database, which is an alternative to the traditional Northwind database. You can get the Chinook database from here. As always the best way to learn something is by working on it and doing something. The Chinook database has the following schema, a quick look will help us implementing the application in a efficient way. Let us first implement a grid view table ...
A simple and straight forward article taken from http://christopherdeweese.c... which uses WCF REST Service Template 40(CS) Drop the Soap: WCF, REST, and Pretty URIs in .NET 4 Years ago I was working in libraries when the Web 2.0 revolution began. One of the things that caught my attention about early start-ups using the AJAX/REST/Web 2.0 model was how nice the URIs were for their applications. Those were my first impressions of REST; pretty ...
The Windows Azure Team had just published their new development portal this week and the SDK 1.3. Within this new release there are a lot of cool feature available. The one I’m looking forward to is Remote Desktop Access to your running Windows Azure Virtual Machine. Configuration Remote Desktop Access It would be very simple to make the azure service enable the remote desktop access. First of all let’s create a new windows azure project from the Visual Studio. In this example I just created a normal ...
Goal: When loading js or css files, combine all the js files into one and all css files into one file respectively when rendering to improve on performance. Also compress if need be on the fly. In this example we use many css files and even more js files to organize the ASP.Net Mvc web app into manageable pieces. The reason for the separation is mainly because it gives the team the ability to work on different part of the web app by working on the affected css or js files. It also helps to decide ...
All-In-One ASP.NET Code Samples Introduction Download ASP.NET code samples Request ASP.NET code samples Introduction The All-In-One ASP.NET code samples demonstrate the typical programming topics about ASP.NET. These topics are either frequently asked in MSDN forums and Microsoft Support, or are requested by many developers via our code sample request function. We want to alleviate the frustration felt by developers when they are developing ASP.NET projects. Visual Studio 2008 ASP.NET Code Samples ...
You may come up against this little error when working on a MVC application, I specifically find things like this crop up when you are upgrading from previous version e.g. VS 2008 to 2010 and the like. They are a complete pain in the bum quite frankly, you can spend hours googling around, trying this trying that, posting questions here and there etc etc…so I’m adding to the this and that which you will of course try, because it’s the sort of error you don’t care about…it’s just getting in the way ...
Sam Abraham (Me) will be speaking at the West Palm Beach .Net Users’ Group on Tuesday November 23rd, 2010 on ASP.Net MVC3 RC, Razor syntax, ASP.Net Web Pages Helpers and NuGet. I plan on sharing an introduction to ASP.Net MVC to bring everybody up to speed then explore the latest features of the ASP.Net MVC 3 Release Candidate. I will also introduce the NuGet Library Package Manager. I hope for this talk to act as a platform for everyone to share their thoughts on ASP.Net MVC and provide their take ...
In this Issue: Martin Krüger, Vikas, Kevin Dockx, Brian Noyes, Kunal Chowdhury, Gergely Orosz, Garry McGlennon, René Schulte, Matias Bonaventura, Bart Czernicki, and Dennis Doomen. Above the Fold: Silverlight: "How to: create a nonrectangular ChildWindow - part 1" Martin Krüger Prism: "Prism Training Kit: Updated to Prism 4.0" Matias Bonaventura Shoutouts: Component Ways has a releast of their xamlDataGrid for Silverlight... might be worth a look ... check out the feature set and download the eval. ...
I was lucky enough to attend Visual Studio Live! in Orlando on November 14th-17th. There were so many great speakers and the networking was great. I met a lot of really cool people and we talked about everything .NET (from WP7, Silverlight, C#, ASP.NET WebForms, AJAX, MVC 3.. and so forth). I took a lot of notes during all the sessions and wanted to provide it to those that could not come out. If you follow me on Twitter then you have seen most of these. Most of the authors put slides/source code ...
There is a bunch of cool stuff coming out of Microsoft right now. As I’ve previously blogged, WCF Web APIs is one of them. One of the cool things that was shown by Glenn Block at PDC a couple of weeks ago was Media Type Processors. Media Type Processors provide a way to allow the consumer of your service to be able to specify the format they want on their response simply by setting the Accept header on the request (and thereby allowing your service to conform to HTTP standards). Out of the box, WCF ...
I had the pleasure of attending and speaking at the Tampa .Net Code Camp 2010. I covered MVC3 and NuGet. I also leveraged the lunch break to show most of Scott Hanselman’s highly rated open source PDC10 session. To watch Scott’s video please visit: http://www.hanselman.com/bl... Mr and Mrs. Keith Kabza and the VisualGov team’s hard work was quiet visible at the nicely organized event where all went smooth from early morning registration to ...
For those of you following the MVC releases, you will see something new in your File->New for MVC3 RC: _ViewStart.cshtml (_ViewStart.vbhtml for you VBers). This is a common place to dry out view dependencies. The most common view dependency is the MasterView it will use. To that end, the default _ViewStart page you get from a File->New MVC3 project has just the: 1: @{ 2: Layout = "~/Views/Shared/_Layout.csh... 3: } This seems to be done by convention. The view must be named “_viewstart.cshtml” ...
Scott Guthrie just announced the release of ASP.Net MVC 3 RC. This new release features Intellisense and syntax colorization for Razor pages. It also includes the recently renamed NuGet (formerly known as NuPack) Library Package Manager. If NuGet is new to you, please check my blog post providing a quick introduction to this useful package. I also have a quick overview of Razor that you can reference if needed. For the authoritative and complete information, please check ScottGu’s blog. To install ...
Over the last 3 years, Microsoft has slowly but surely been embracing REST as a programming model for the web in WCF. .NET 3.5 SP1 introduced some REST constructs allowing us to invoke WCF services with HTTP GET/POST/PUT/DELETE verbs in conjunction with UriTemplates. The REST Starter Kit (RSK) was then introduced on CodePlex and this provided many great features including an HTML help page, request interceptors, an HTTP client library, and more. Then WCF 4 was released and some of the features in ...
Sam Abraham (Me) will be introducing ASP.Net MVC 3 at the Tampa .Net Code Camp, taking place on Saturday November 13th, 2010. I plan to introduce ASP.Net MVC and showcase the latest and greatest features introduced with ASP.Net MVC3 including: Razor syntax, ASP.Net Web Pages Helpers and NuGet (formerly NuPack). Audience participation is encouraged and will be solicited. Look forward to seeing you all there! Here is the description and bio I submitted: Introducing ASP.Net MVC In this session, we will ...
One of the first things I build for a new feature in MVC is a controller, with actions. For the C# Tutorial at C# Station, I built a CSharpTutorial controller and began looking at what actions were necessary. Considering the tutorial is at 23 lessons and growing, it doesn’t make much sense to create that many actions; especially with the glaring redundancy. The solution in this situation is a custom route. The following route definition solves this problem by isolating a parameter, lessonNumber: ...
On Thursday October 28th, 2010, I had the privilege of attending and speaking at the SoFla Local PDC10 hosted by the Gold Coast and Miami .Net User Groups. While most local PDCs focused on viewing the Redmond event, South Florida kicked it up a notch by availing some of the community’s local speakers to comment and address any questions the audience might have. I greatly enjoyed covering and answering audience questions on WebMatrix, Razor Syntax, ASP.Net Web Pages Helpers, IIS Express, ASP.Net MVC ...
Many sites have a contact form, instead of posting email addresses. Admittedly, email addresses are convenient for customers because they can use a mailto link that brings up their email client and allow them to start typing, archive the communication, and manage the thread. When I first started C# Station, that’s what I did; posted my email address for everyone. Holy cow, what a mistake. I received so much spam that my inbox was unusable. Fortunately, spam is more manageable these days, but it’s ...
With concerns of HTML 5 overshadowing or affecting the roadmap for Silverlight actively addressed in many blog posts, I decided to cover the value HTML 5 brings to another set of web-based Microsoft solutions: ASP.Net MVC 3 and WebMatrix. A direction to embrace HTML 5 can already be clearly seen in ASP.Net MVC 3 with Unobtrusive Javascript leveraging the “data-“HTML 5 attributes. Additionally, WebMatrix Razor site templates are already HTML5 and CSS3 compliant while continuing to be backwards compatible ...
Sam Abraham (Me) will be speaking at the SoFla PDC 2010 hosted by the Gold Coast and Miami .Net User Groups in Boca Raton, Florida on October 28th, 2010. The local PDC event will run in parallel to and will embrace some of the content covered and unveiled at the main PDC 2010 hosted in Redmond. This would be my third speaking event in a quiet busy October 2010 and my second visit as speaker to the Gold Coast .Net User’s Group for the month of October. I will be covering WebMatrix, Razor Syntax, ASP.Net ...
Before working with MVC, I would claim to be somewhat intimidated by JavaScript development. Not that I did not know how to use it, however I found that is was much more bug prone and harder to develop against. Having the .Net compiler was a nice safety net-I did not have to worry about variable name mismatch, typos, not to mention the .Net framework itself. In a recent ASP.Net project we used the MS AJAX update panel to implement interface changes that could easily be implemented via client side ...
WebMatrix is a free “one stop shop” supporting all developers’ needs when creating web sites based on standard markup technologies (HTML, CSS, Javascript and jQuery). WebMatrix features an intuitive user interface to help minimize the learning curve and ease navigation and access to all application features. For instance, on startup WebMatrix enables the user to select of the following: 1-Existing sites created in WebMatrix 2-Obtain a site from one of the open source packages through Web Platform ...
In this article i will show how to read feeds rss. In this example i will show it for MVC architecture but it's very easy to use it in webforms. (use the SyndicationFeed object as a datasource for an repeater for example). Let's declare our SyndicationFeed object in Model: public class BlogModel { public SyndicationFeed BlogFeed { get; set; } } In Controller we'll get the feeds. But first, we need to add new references to our project: System.ServiceModel.Syndica... e System.Xml public ActionResult ...
Sometimes it seems implementing functionality in ‘standard’ asp.net takes several times longer than with MVC. In my case, I wanted to do the following when changing a checkbox on a form page (page uses partial page update). Note that I needed to use both client side and server side functionality, and the page updates only part of the page. On checkbox changed, display an “are you sure” popupup. On ‘Ok’, call server method to modify data on the backend, re-bind part of the page. On ‘Cancel’, close ...
I had the pleasure of speaking with Joe Homnick today about the Open Data Protocol. I presented an example on consuming OData in an MVC solution using jQuery. Joe presented on consuming OData feeds in SharePoint 2010/Silverlight 4.0 as well as a nice sample on setting up an OData service interface. I appreciate the opportunity to speak at a user group known for consistently bringing in only the very best speakers and content. At the end of the talk, I was presented with a certificate of appreciation ...
At a high level, this is how I understand the different MVC tiers: Model: Data libraries such as entities, Linq to SQL classes, or any other data library. View: The .aspx/.ascx pages. The classic ASP style code goes here. I have heard this layer referred to as a ‘report’ where you have as little logic as possible, and only that related to the display of the page. Controller: If you are coming from ‘standard’ ASP.Net and are new to MVC, You could say the controller is what replaces the code behind. ...
Someone asked me the other day, between Standard ASP.Net and ASP.Net MVC, which do I prefer and why. Although I have long been an ASP.Net developer, I have to say that I easily would choose MVC over standard ASP.net any day (and twice on Sunday). I feel this for the following reasons: Separation of interests: The three sections of MVC are logically separated: Model(Data), View(.aspx page), Controller (Code that feeds data to view). NO VIEWSTATE: If you are new to MVC, you think this is a bad thing, ...
As I continue to explore ASP.Net MVC 3, I decided to share a little on NuPack Tools, a recently released Visual Studio 2010 extension. There are a few nice blog entries on NuPack already which you can access here. Figure 1 - NuPack Tools shown as a Visual Studio 2010 Extension What is NuPack Tools? NuPack Tools is a Visual Studio 2010 Extension installed along with ASP.Net MVC 3 and also available as a stand-alone install. It provides a friendly interface that automates the retrieval and installation ...
The biggest question as a new version of a product or framework comes out is whether an upgrade path from the prior version exists and if the new features introduced are worth the headache and time investment made to upgrade. For ASP.Net MVC 3, the answer is yes to both questions. Personally, I would wait until ASP.Net MVC 3 is officially released, but for those wanting to upgrade right away, details for the upgrade can be found here and are pretty straight forward. Today, I decided to tackle a potential ...
Today, I found a good answer on syntax highlighting for Razor. In the Visual Studio Gallery located at http://visualstudiogallery.... a new Visual Studio extension has been recently added for a “Razor Syntax Highlighter”. To leverage this new extension, I had to remove the editor mapping for .cshtml files in the Visual Studio Text Editor/File Extensions window (as outlined in my previous blog post) and install the highlighter extension. As ...
Thanks to all those who attended my session Retrofit WebForms with ASP.NET MVC at the Richmond Code Camp 2010.2. To be honest, it was my very first time speaking at a big event like this and I was quite nervous during it. I realized after the demo that I went through the topics quite faster than I should. Nonetheless, I hope my session was helpful and you learned something from it. Thank you all for asking very good questions so I can improve my presentation for next time. Please let me know if you ...
It has been over a year since the last time I updated my list of Florida technical communities and a lot has changed since then. Joe Healy, our Florida Microsoft Developer Evangelist, maintains a list for each of the main areas in Florida, but this only covers the .NET-focused groups. Taking what he has started, I have put together a similar list (based on the information Joe maintains) that covers the other technical communities that I know of. If you are part of a technical user group community ...
In this blog post, we will take a quick look at the new MVC 3 project options as well as the pretty sharp Razor View Engine (not suitable for shaving :) ). Based on a nice Stackoverflow post, it seems that MVC 3/Razor will only be supported in Visual Studio 2010/.Net 4.0. This is great as it will give developers yet another good selling point to argue for upgrading to .Net 4.0. Creating a new ASP.Net MVC 3 project Prior to ASP.Net MVC 3 Beta, Selecting “New Project” in VS 2010 yielded two templates ...