Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
 
 
DZone MVB

Links

Social

Browse by Tags

All Tags » MVC (RSS)
ASP.NET MVC: Helper method to display date ranges
I have events web site where I want to show events start and end time to visitors. I wrote simple extension method called DisplayTimeRange() to display event time range on user-friendly manner. My goal is to show times as 01.01.2012 10:00 – 14:00 and...
Posted: Dec 31 2011, 11:53 AM by DigiMortal | with 7 comment(s)
Filed under: ,
ASP.NET MVC: Simple view to display contents of DataTable
In one of my current projects I have to show reports based on SQL Server views. My code should be not aware of data it shows. It just asks data from view and displays it user. As WebGrid didn’t seem to work with DataTable (at least with no hocus-pocus...
Posted: Nov 19 2011, 01:46 PM by DigiMortal | with 1 comment(s)
Filed under: ,
ASP.NET MVC: Converting business objects to select list items
Some of our business classes are used to fill dropdown boxes or select lists. And often you have some base class for all your business classes. In this posting I will show you how to use base business class to write extension method that converts collection...
Posted: Nov 10 2011, 11:10 AM by DigiMortal | with 4 comment(s)
Filed under: ,
ASP.NET MVC 4: Display modes
One new features of ASP.NET MVC 4 is support for display modes. This means that you can conditionally show different output to different user agents like desktop and mobile browsers. Of course, you can define your own custom rules too. In this posting...
Posted: Sep 18 2011, 09:06 PM by DigiMortal | with 5 comment(s)
Filed under: , ,
ASP.NET MVC 4: New template for web applications
I’m playing with ASP.NET MVC 4 Developer Preview. There is new default application template available for ASP.NET MVC 4 web applications. New template is modern, has better look than current one and has better support for different screen sizes. In this...
Posted: Sep 16 2011, 12:09 PM by DigiMortal | with 5 comment(s)
Filed under: ,
Using Moq to mock ASP.NET MVC HttpContextBase
Here’s my little example about how to use Moq to mock HttpContextBase and it’s members to make controller tests pass. You can use this code when you are not allowed to use open-source or use-on-your-own-risk pieces of software that provide you this kind...
Posted: Jul 16 2011, 12:52 PM by DigiMortal | with 4 comment(s)
Filed under: , ,
ASP.NET MVC: Moving code from controller action to service layer
I fixed one controller action in my application that doesn’t seemed good enough for me. It wasn’t big move I did but worth to show to beginners how nice code you can write when using correct layering in your application. As an example I use code from...
ASP.NET MVC: Showing dates using DayCalendarPage extension method
In my events web site I need to show event dates in lists so users can easily see them. I decided to use day calendar view like shown on image on left. As there are more than one view where I need this functionality I wrote HTML extension method that...
ASP.NET MVC: Getting selected values from CheckBoxList
In my last posting I introduced how to implement CheckBoxList in ASP.NET MVC . Showing checkbox list is one part of the story. When user saves the form then we have to update also data that was represented by CheckBoxList. In this posting I will show...
ASP.NET MVC: Implementing CheckBoxList
My events site I’m building ASP.NET MVC got tags support for events. I implemented CheckBoxList helper method and tag updater method that I can use to update tags assigned to events. In this posting I will show you how to implement tags support using...
More Posts Next page »