calendar_today 11 September 2010 09:35
There are times when you want to query a database for records matching a range of values, but you do not know what those values are, or even how many there are at design time. You could dynamically build your WHERE clause with multiple ORs, or you can use the SQL IN clause - except that the current database helpers in WebMatrix don't make this easy. It's about time that was fixed....
calendar_today 10 August 2010 17:23
Even though WebMatrix is still in its first Beta, there have been a few requests in forums already for examples illustrating how to create Web Pages forms powered by AJAX. Building on previous articles, I thought I'd put together a little sample that shows how to do this to add a record to a database using jQuery. Here's how it's done.
calendar_today 08 August 2010 09:33
One of the most useful helpers provided by ASP.NET Web Pages via WebMatrix is likely to be the WebGrid, which is designed for displaying tabular data. Still in Beta 1, documentation is sparse, so here's a more detailed look the WebGrid Helper.
calendar_today 30 July 2010 15:27
With the launch of WebMatrix, and the announcement of the new Razor View Engine for the next version of ASP.NET MVC, here's a quick guide to Razor syntax.
calendar_today 25 July 2010 09:52
In the first of my WebMatrix articles, I mentioned that entering data via the database design forms is a bit of a pain. I also promised to look at editing data via a web page at some stage. This article keeps that promise, and looks at adding data too.
calendar_today 18 July 2010 21:37
The Beta1 version of WebMatrix comes with a number of Web Pages helpers to make your life simple. These include helpers to work with file uploading, images, email, caching, grids, Twitter feeds and a lot more. I suspect that as the product evolves towards full release, more will be added. Nevertheless, the developers of WebMatrix and Web Pages cannot anticipate every requirement, so there will be a time when you feel you need something extra. Adding your own helpers is quite easy, as this article shows.
calendar_today 17 July 2010 10:48
If you want to display your data over a number of pages using WebMatrix Beta1, you have two options. One is to use the built-in paging support that comes with the WebGrid helper. But that means that your data will be displayed within an HTML table. If that is not your preferred layout choice, you need to write your own paging code. Let's look at how you can do that.
calendar_today 12 July 2010 21:27
Here's something that comes up often in forums - How To Find Yesterday in SQL or C#. Piece of cake, if you know how, but tricky if you don't. And especially tricky to get the right value if you are not clear on the requirement.
calendar_today 09 July 2010 20:28
A perennial choice that web developers have to make is whether to store uploaded files to the file system or a database. Each method has its pros and cons, and the debate over which approach is best continues to rage. This article will not add to the noise. It will simply demonstrate how to upload files to the Sql Server CE database which is the default option in Web Pages, and how to retrieve them for users again.
calendar_today 07 July 2010 22:04
Most web development frameworks provide features that assist with creating a consistent look and feel across pages, or make provision for managing reusable partial content, such as headers and footers. The Web Pages framework is no exception. This article examines the core features offered by its Razor view engine for handling templated layouts and common blocks of content.
calendar_today 06 July 2010 21:35
This article will take a first look at WebMatrix - Microsoft's new IDE for developing Web Pages applications. In it, I will cover a number of the core features that will make Web Matrix the ideal starter's web development framework as I create a very simple application.
calendar_today 06 July 2010 20:51
There has been a spate of announcements recently from Scott Guthrie, the main Microsoft man responsible for ASP.NET over the last week or so - the launch of IIS Express, a new version of SQL Server Compact Edition (CE) that can be run in medium trust environments, and a new View Engine and syntax called Razor. Each of these announcements have generated a lot of reaction, and they are each significant in themselves. They all make ASP.NET easier for existing developers. However, if you put them all together, and throw in a new framework and IDE, they make ASP.NET much, much easier for new developers coming to ASP.NET for the first time. So that's what Microsoft have gone and done. And today, they have announced the first Beta version of WebMatrix - a head-on competitor to WAMP stacks.
calendar_today 23 June 2010 07:43
Include files within classic ASP are about the only way to achieve some measure of code-reuse within frameworks that offer little or nothing by way of composition or inheritance. Judging by the number of questions in forums, there are still a lot of people moving across from classic ASP who are puzzled as to how to approach replacing include files within ASP.NET. A number of articles illustrate individually how to do so for site-wide layout reasons, including widgets, reusing global functions, or actually including the content of a file. However, I haven't been able to find one resource that brings all these together, hence the purpose of this article.
calendar_today 14 June 2010 10:15
Named Anchors are used to generate links to specific locations within a web document. Unless you are careful, you may end up having a little trouble getting these to work using the MVC LinkExtension helpers.
calendar_today 31 May 2010 20:42
My previous article showed how to use a custom ActionResult and the classes within WCF to generate an RSS feed. There are no similar classes to help build a valid Google Site Map for an ASP.NET MVC application. So here's how your can build your own.
calendar_today 31 May 2010 09:14
When I looked at producing RSS Feeds in ASP.NET MVC before, I used the ContentResult method to return XML. Best Practice suggests that you should create a new ActionResult if required. So this article looks at creating an RssResult, and a different way to generate the feed itself.
calendar_today 22 May 2010 22:56
Following on from the recent spate of extensions methods I've posted, here's another I use to convert URLs and email addresses into links within HTML. You may want to restrict users from submitting HTML tags via forms in your application, which means that URLs and email addresses that they submit appear as plain text unless they are subjected to some kind of processing.
calendar_today 22 May 2010 19:41
A common question in the forums is how to highlight key words found in search results. Here's an extension method that does that, both for partial matches, or whole word matches.
calendar_today 21 May 2010 21:12
The jQuery Cycle plug-in is most often used for creating image slide shows. However, it's just as easy to use to create a news scroller from a ListView. Here, I look a doing just that. I also look at an alternative jQuery plug-in (NewsTicker) that gives the effect of the classic BBC News Ticker.
calendar_today 16 May 2010 09:59
Displaying the first n characters of a block of text on a page without chopping words off halfway through is a common requirement. There are a number of ways to achieve this, but here's an extension method that you might find useful.