Tag | ASP.NET MVC Posts

Introduction SignalR is a pretty new and very exciting feature in ASP.NET. It offers a simple and clean API that allows you to create real time web applications where the server needs to continuously push data to clients. Common applications are chat, news feeds, notifications and multi-player games. For this exercise we’re going to build a simple chat application in ASP.NET MVC 4 using the power of SignalR. I presume that you already have the basic knowledge on ASP.NET MVC and how stuff works (e.g. ...

Working with client-side technologies like JavaScript's and Ajax can sometimes be a pain in the butt. One practical example is if you’d like to display a message to the end user or do something else after all Ajax calls within the loop are completed. In this post I’m going to show how to make it work. Suppose that we have this JavaScript block below that iterates the table row to get the item ID stored in an input element and then call an action method from the controller through Ajax by passing ...

Yesterday’s training session was a success with few developers from Cebu attended the session. The core topic I’ve talked about was ASP.NET MVC. Here’s the full list of the topics below: An Intro to ASP.NET MVC MVC and MVP Pattern – The Difference MVC and WebForms – The Difference What does ASP.NET WebForm and MVC values? Core ASP.NET MVC and it’s core features An Intro to Entity Framework and LINQ Sample MVC Application Demo Creating a Sign-Up page Creating a LogOn page Fetching, Editing and Updating ...

For the last decade, I have repeatedly, in my imitable Microsoft fan boy style, offered an alternative view to commonly held beliefs about Microsoft's stance on open source licensing. In earlier times, leading figures in Microsoft were very vocal in resisting the idea that commercial licensing is outmoded or morally reprehensible. Many people interpreted this as all-out corporate opposition to open source licensing. I never read it that way. It is true that I've met individual employees of Microsoft ...

We are almost done everything about the WCF transport extension over the message bus, which makes our services can be scaled out by introducing more instances over machines and servers. We had finished the structure of our transport extension and implemented the request reply mode in the 2nd post, the datagram and duplex mode in the 4th and 5th post. As I have said at the end of the 5th post, currently we can use our transport extension. But there still something left. Although are not that major ...

The ASP.NET MVC template drops a copy of Modernizr 1.7 in your project automatically, and if you check for NuGet updates the library is brought up to the current version - 2.5.3. The NuGet package is a a great way to introduce developers to Modernizr and makes checks for updates easy. But when adding Modernizr to your projects consider two alternatives: Alternative One – Content Delivery Network: Microsoft CDN currently hosts two Modernizr versions – 1.7 and 2.0.6. By using a CDN copy you increase ...

Single Page Application Frameworks are gaining popularity in the ever evolving web community with lot of libraries such as JavaScriptMVC, Backbonejs and many other libraries. ASP.NET MVC 4 introduces experimental support for building single page application (SPA) through a template. Much of the plumbing work of wiring up the client side scripts, javascript modelviews and the controllers is automated, making it a quick start to develop SPAs relatively easier. Lets examine a scenario where we are building ...

This is my first post in this new year and was thinking about a topic to write on. Lately I have been working on varied things that flexes the brain muscles and things which I haven't done before. So a lot of learning and some unlearning this new year. One of the big issue which most people faces is learning to learn!.So, today I will share my experience of how I go about learning a technology, a skill or anything you want. The first and foremost thing is the motivation. This thing is very personal ...

In a previous posting, I discussed replacing the stock MVC serializer used for the JsonResult exposed when you use the controller method Json(..) instead of View. This was all find and dandy. But how – you may wonder – can I call actions that contain complex parameters? Do I need a special binder? Should I write my own? The answer is mostly "no". As Phil Hack blogged, the ASP.NET MVC framework already contains value providers that take care of that for you. All you need to do is ensure that your ...

This demo is a continuation of my previous article about "Creating a Simple Log-in Form". Basically in this post I'm going to demonstrate the basic on how to edit and update the form with ASP.NET MVC 3. Before you go any further, I'd suggest you to check out my previous article first about "ASP.NET MVC 3: Creating a Simple Sign-Up Form" and "Creating a Simple Log-in Form". STEP 1: Creating the Model class Just for the simplicity of this demo, I'm just going to display the FirstName, LastName and ...

The typical way to check for whether anything has changed in the view when you’re navigating away from a page is to bind a method to the change event of each input and to set a flag if this has happened. This flag is then checked when leaving the page and a notification is shown to the user if the flag is raised. This is all good but it does not take into account things like changing the order of inputs and changing values back to their original values. Also, creating dynamic elements makes this ...

Today's $10 Deal of the day from Apress at http://www.apress.com/97814... is "Pro ASP.NET MVC 2 Framework" "In this book, you'll discover MVC's strengths and weaknesses for yourself—and put your best-learned theory into practice." If you are working at a site using MVC, then this is a very useful book ...

This demo is a continuation of my previous article about "ASP.NET MVC 3: Creating a Simple Sign-Up Form" which I wrote few months ago. Basically in this post I'm going to demonstrate how to create a simple LogOn form in which users can supply their username and password. And how to authenticate and validate users in ASP.NET MVC 3. I will not elaborate more in details about the model, view and controllers function so before you go any further, I'd suggest you to check my previous article first about ...

I’ve heard people mention, a few times, how they would like for Microsoft to provide a blank template for ASP.NET MVC. The request seems strange because this is something that anyone can do themselves. This isn’t just creating an MVC project and deleting all the items, which I would agree is tedious. Rather, you can create a custom template of any type for reuse and sharing. This blog post shows how to create a custom project template, using the need for a blank MVC template as the use case. Creating ...

I was recently made aware of a couple of people having issues with WCF services (or ASP.NET applications) when using the MVVM Light project template for Silverlight. There is a blog post and a StackOverflow question, so what exactly is happening there?

This was a very interesting event, I had never spoken in an event with so many developers in one place. It was cool! I had two talks, one on HTML5 and IE9 where I demonstrated the HTML5 and CSS3 coverage in IE9 and performance improvements, the second on ASP.NET MVC Best Practices where I talked about a fraction of things that you need to be aware of and possibly use when you are developing an MVC application. The HTML5 and IE9 talk was more of a showcase and focused on new features that will continue ...

Using a simulated dialog window is a nice way to handle inline data editing. The jQuery UI has a UI widget for a dialog window that makes it easy to get up and running with it in your application. With the release of ASP.NET MVC 3, Microsoft included the jQuery UI scripts and files in the MVC 3 project templates for Visual Studio. With the release of the MVC 3 Tools Update, Microsoft implemented the inclusion of those with NuGet as packages. That means we can get up and running using the latest version ...

I've recently refactored the way Routes are declared in an ASP.NET MVC application I'm working on, and I wanted to share part of the system I came up with; a really easy way to declare and keep track of ASP.NET MVC Routes, which then allows you to find the name of the Route which has been selected for the current request. Traditional MVC Route Declaration Traditionally, ASP.NET MVC Routes are added to the application's RouteCollection using overloads of the RouteCollection.MapRoute() method; for ...

This is the 5th post in the series of HTML5 for ASP.NET Developers Support for HTML5 in Visual Studio 2010 has been quite good with Visual Studio Service Pack 1 However, HTML5 Boilerplate template has been one of the most popular HTML5 templates out in the internet. Now, there is one for your favorite ASP.NET Webforms as well as ASP.NET MVC 3 Projects (even for ASP.NET MVC 2). And its available in the most optimal place, i.e. NuGet. Lets see it in action. Let us fire up Visual Studio 2010 and create ...

One of the cool things about HTML5 is the ability to play audio/video files out of the box without the dependency on plugins. Earlier I had written about HTML5 Video and the fallback using Silverlight for non-supported scenarios Visual Studio 2010 SP1 has decent support for HTML5, in terms of intellisense, validation etc., But, one issue that is constantly faced when using the HTML5 Video tag in an ASP.NET Application (Web/MVC) built using Visual Studio is that, the videos doesn’t play when running ...

In the past weeks I have discussed about the Preview ASP.NET MVC 4. So, now I will show another great features in ASP.NET MVC 4. After installing, you will have new ASP.NET MVC4 Web Application template when creating new project in VS.NET 2010. Once you click OK the following dialog box will appear If you have experience with ASP.NET MVC3, you will realize that the selected template int he previous screen, Mobile Application, wasn't there up to now. So, in ASP.NET MVC4 we have new Mobile Application ...

I am playing more with the Windows Developer Preview and simply love the backward compatibility it has for applications that used to work in Windows 7. And one of the applications critical to my day-to-day life is Visual Studio. Visual Studio 2010 with SP1 and ASP.NET MVC 3 Tools is my everyday requirement. Windows Developer Preview when installed from the MSDN Center has two flavors. One with the Developer Tools which I would assume, most of us developers would want and the other one, which is simply ...

Today the Microsoft announced that the In-Place Upgrade feature had had some improvements. The major one would be, now the user could be able to change the VM Size by In-Place Upgrade, without redeploying the whole service. What We Did Before Before this improvement, since the VM Size was defined in the CSDEF file, we have to redeploy the service to change the VM Size property. This means we would remove the existing roles and VMs and then ask the Windows Azure to reallocate the new VMs with the ...

If you are planning to deploy your application with SQL CE as your application backend then here are the steps you need to perform. If you’re planning to deploy your application with SQL Server, than please read this post, How to Deploy an ASP.NET MVC 3 App to Web Hosting with "\bin Deployment" I assume that you have your ASP.NET MVC 3 application ready to be deployed with SQL CE 4.0 and EF 4.1. But make sure you have add assembly and for SQL CE 4.0 using NuGet. I recommend you to use NuGet here ...

This would be the first in the series of posts I plan to do for HTML5 for ASP.NET Developers The first thing that everyone would have experienced is the HTML5 header tag. The regular header tag that Visual Studio creates for ASP.NET Webforms is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml... This would be the header tag present in the Master Page or the actual ASPX Page when you don’t inherit from a Master Page. Till HTML5 specifications ...

Today post will show you how to build an Ajax form with JQuery validate supporting (unobtrusive) client and server side validation using ASP.NET MVC 3. If you want to see an examples, you can visit this post about Ajax in ASP.NET MVC 3. To enable (unobtrusive) client side Ajax and validation support include the following JavaScript files (in Views/Shared/_Layout.cshtml): javascript" src="@Url.Content("~/Script... <script type="text/javascript" src="@Url.Content("~/Script... ...

I've made a list of programming books I've read, am reading and am going to read on the Bookshelved Wiki; would anyone care to recommend good books for a web-oriented, C# Agile programmer which I've not discovered or not considered?I've reproduced the list so far below for convenience :)Programming books on my 'to read' list Real World Functional Programming by Tomas PetricekCode Complete by Steve McConnellWorking Effectively With Legacy Code by Michael FeathersProgramming books being read at the ...

In my particular case the problem was due to Silverlight. I have my ASP.NET MVC application which is incorporating a Silverlight application into it. When integrating the Silverlight application VS will ask you if you want to allow for debugging your Silverlight application. Selecting yes will enable the Silverlight debugger in your web applications project settings (see below): To allow JavaScript debugging again simply uncheck the Silverlight checkbox and start your application ...

Soon, the latest ASP.NET MVC will be launched. I cant wait to try as whole. This is the preview of this new product- Web Platform Installer – Installs the MVC4 Project Templates.- Nuget package – perfect for upgrading an existing MVC3 project- Stand Alone Installer- Installs the MVC4 Project Templates. This is the cool design with new features In addition to CSS design there is improved functionality in the new template. The template support technique called adaptive rendering to support theme on ...

In the recently concluded WebCamps, Delhi, I was demonstrating Facebook Authentication implementation for your website using WebMatrix 2 Beta. You can read about my earlier post on WebMatrix 2 Beta from here Using the new WebMatrix 2 Beta, we can create a decent looking starter site with a few clicks as explained in my above post. Once we have the site up and running, we would want to implement authentication. Now, like ASP.NET 4, ASP.NET MVC 3 etc., WebMatrix comes with default Membership infrastructure. ...

When we talk about UI Architecture, a common theme of Model-View-Something continues to come up. The question is, however, what is the something? Am I working with Model-View-Controller? Model-View-Presenter? Something else? The purpose of this blog is to explore the difference between MVC / MVP to give you an understanding of what they mean to accomplish, what are the differences and what situations best cater to each. Does it really matter? Does the difference really matter between MVC / MVP? Well, ...

Most people who are really into ASP.Net MVC probably enjoy its test-driven nature or "unit-testability". This is a key benefit of the asynchronous model used by the MVC framework when action results are returned. Another benefit of this is in memory management. I am working on creating a large document which is to be available both online and offline and consists of several hundred (potentialy more than a thousand) items. The items are stored in a tree structure where each item has children and children ...

Well, as mentioned in my earlier posts, the ASP.NET MVC 4 has Developer Preview has been released. You might notice quite a bit of this term “Developer Preview” in 2-3 products specifically. One, Windows 8 is now available as simply Windows Developer Preview. Similarly, Visual Studio 11 is Developer Preview and also the Internet Explorer Platform Preview 3 is a Developer Preview, as with the case with Expression etc., Now, to clarify on a few things which I learnt. The Windows 8, hereinafter referred ...

Yesterday I wrote this post but forgot to mention about something that is very close to my heart ASP.NET MVC. ASP.NET MVC has been evolving rapidly and within 2 years, we already have had 4 major releases (MVC 1, MVC 2, MVC 3 & MVC 3 Reloaded ) So, it doesn’t go as a surprise that MVC 4 is on the cards and the developer preview was unveiled at BUILD Conference. What does MVC 4 offer for web developers? Enhanced Default Project Template If you are bored with the vanilla blue template that comes ...

Issue: Due to an upgrade from .Net 2, 3.0 or 3.5 to .Net 4.0 or you are starting a new .Net 4.0 project, you may run into this message: A potentially dangerous Request.Path value was detected from the client Or A potentially dangerous Request.Form value was detected from the client Environment: .Net 4.0 MVC 3 (could be MVC 2 also because of the controller/action action filters that are available) Fix: Lets tackle the first issue: A potentially dangerous Request.Path value was detected from the client ...

Official Site | Samples | Download | Documentation | Forum | Twitter Introduction jqChart takes advantages of HTML5 Canvas to deliver high performance client-side charts and graphs across browsers (IE 6+, Firefox, Chrome, Opera, Safari) and devices, including iOS and Android mobile devices. Some of the key features are: High performance rendering. Animaitons. Scrolling/Zoooming. Support for unlimited number of data series and data points. Support for unlimited number of chart axes. True DateTime ...

When testing in ASP.NET MVC3, one of the common elements you might want to test is authorization. Although the framework does most of the heavy lifting for ASP.NET Membership and authorization it is still worthwhile to be able to write a test to show that the proper Authorization tag is in place. You might think that it’s as easy as calling the method on the controller with a proper context, but that’s not the case. When you call the methods directly on the controller the authorizations are skipped. ...

Wijmo is an awesome tool from ComponentOne. The goal of this tool is to help us web developers rapidly develop MVC applications with interfaces richer than WebForms. Main Features: 1.Over 30 UI Widgets with everything from interactive menus to rich charts. 2.MVC scaffolding automation. This means that Wijmo generates rich interactive Views and Controllers for your entire Model. Free Trial DownLoad: http://www.componentone.com... In this review we'll take a look at Wijmo ...

Download is at http://stylecop.codeplex.co... This is still an "Alpha" release: "Exactly the same rules as 4.5 but built for compatibility wit JetBrains R#6. Current alpha Status Installer working Inline analysis working and underlining the stylecop issues found as you type Context menus working BulbItems working Many QuickFixes from bulbitems working Code cleanup working now Options pane working now" I will try it and report. Passionate aboutOutstanding productivity tool for ASP.NET ...

I am a firm believer that, regardless of the framework you use, if the framework is good it provides you all of the things you need. I believe ASP.Net MVC 2 is good and therefore provides me everything I need. This means I don't need to write a significant amount of custom UI code (jQuery, MVC Ajax, etc.) to do things that should be considered "standard". One of these pretty standard things submitting a form via Ajax. MVC provides for this very well with Ajax.BeginForm. The contents of the form are ...

This morning I got the information that the Windows Azure Tools for Visual Studio 2010 - August 2011 Upgrade had been released. The version of this new upgrade is 1.4.40727.1601 with the Windows Azure SDK v1.4.20407.2049. This upgrade includes some awesome features that I was looking forward for a long time, which are: Profiling the application running in Windows Azure. New ASP.NET MVC 3 web role template. Multi-configuration files in one cloud project. More validation in the service package and ...

After writing this post, I realized that it is obnoxiously long, and maybe includes a little bit too much hand-holding. Nevertheless, I decided to post this very detailed step-by-step walkthrough of implementing a simple AJAX form in MVC3 with Razor. I'm probably going also post a shortened version of this topic for those that don't need a complete walkthrogh. So I've been attempting to dive into ASP.NET MVC 3 lately, and have hit plenty of bumps along the way. This is my first encounter with any ...

What is Common Service Locator?Today we have many Inversion of Control/Dependency Injection Containers like NInject,StructureMap,Unity,.. etc in the .NET world.Most of these vary quite widely in terms of configuration and initialization/registration of the instances.But they provide more or less similar interface while resolving the dependencies and returning object instances.Common Service Locator framework extracts these commonalities out and provides an abstraction on top of these IoC/DI containers.This ...

Yesterday I received an email from Jetbrains to notify me of the release of ReSharper 6. Highlights of ReSharper 6 include: Rich support for JavaScript, CSS, HTML, and ASP.NET MVC 3 (Razor) Bundled assembly decompiler New navigation actions and valuable additions to existing navigation features Code inspections and quick-fixes for code quality analysis in VB.NET code Multiple new code inspections and quick-fixes for C# Improved refactorings and context actions, including those helping convert LINQ ...

Continuing my short but sweet posts regarding issues I've encountered and corrected during development...... If you are working with the Telerik MVC suite of controls within your ASP.NET MVC application you may encounter a JavaScript error similar to "Object doesn't support this property or method". The problem? Telerik controls make use of jQuery and by default will add a script registrar to your view which then automatically includes the core jQuery JavaScript files. Like many developers you may ...

I hope you haven’t come here looking for an answer!!! Because I want one too!!! I have recently been playing with JQM…and initially loved it….but…. I mean, jQuery mobile is fantastic...whats been done here I think is awesome. I'm enjoying working with it. (I know its beta 1!, but the below seems odd for even a beta release) There seems to be some fundamental bugs knocking about. Links for example. I have a fixed footer toolbar...3 buttons, Home, New, Settings. Home - I wanted to be non-ajax, so I ...

String Resources For string resources we will use local/global resources connecting to DB using DbResourceProvider from “Creating a Data Driven ASP.NET Localization Resource Provider and Editor” http://www.west-wind.com/pr... It also has DbResourceControl, that shows controls with Localizable attribute and connect them to editor. From http://guysmithferrier.com/... and http://www.guysmithferrier.... ...

I’m starting to see a whole bunch of tweets and blog posts on how Silverlight/WPF is dead, or how the XAML team has been disbanded at Microsoft, or how someone predicted Silverlight would die, blah blah blah. They all have a similar ring to it though: “Told ya so!” “They were stupid ideas anyway!” “Serves Microsoft right, boy are they dumb!” Let me tell you something, all those that are gleefully raving about Silverlight/WPF’s demise are nothing more than death trolls. Let’s assume that everything ...