Items By Type: Tutorial

Creating Reusable Components For ASP.NET Razor Web Pages

Tuesday, February 4, 2014 7:39 PM

ASP.NET Web Pages WebMatrix

There are a number of ways that you can maximise code re-use within a Razor Web Pages site: Layout pages, helpers, functions and so on. As you build more sites, you soon find that you are repeating code between them. You might have a collection of custom utility functions and extension methods, for example that you find yourself copying and pasting across sites. Over time, this will become a maintenance nightmare as different versions of the methods live in different sites. This article shows how to solve that problem easily by creating a library that can be shared across multiple sites.

Click to read more about Creating Reusable Components For ASP.NET Razor Web Pages ...

Viewed 13759 times

4 Comments for this item

Adding a New Row In The Razor WebGrid

Thursday, January 23, 2014 8:10 AM

ASP.NET Web Pages WebMatrix Razor WebGrid

The Razor WebGrid isn't just used for displaying data. I have already looked at how to edit data inline within the WebGrid, so this article looks at how to add new rows of data. within a rendered grid.

Click to read more about Adding a New Row In The Razor WebGrid ...

Viewed 20917 times

2 Comments for this item

Request Validation In ASP.NET Web Pages

Wednesday, December 18, 2013 11:24 AM

ASP.NET Web Pages WebMatrix Razor

Cross Site Scripting (XSS) attacks are the third on the Open Web Application Security Project's (OWASP) 2013 list of security vulnerabilities. This article looks at the defence mechanisms built into ASP.NET that protect against such attacks and how you can disable those defences in ASP.NET Razor Web Pages in a safe manner when you need to.

Click to read more about Request Validation In ASP.NET Web Pages ...

Viewed 39046 times

6 Comments for this item

Check Duplicate User Names In ASP.NET Web Pages Sites

Friday, November 29, 2013 3:22 PM

AJAX jQuery ASP.NET Web Pages WebMatrix Razor

The Web Pages Starter Site template provides a useful starting point for developing a Razor Web Pages site that includes membership. But it doesn't include any mechanism for preventing duplicate user names. This article offers one solution to the problem that uses jQuery.

Click to read more about Check Duplicate User Names In ASP.NET Web Pages Sites ...

Viewed 17192 times

5 Comments for this item

Posting Data With jQuery AJAX In ASP.NET Razor Web Pages

Wednesday, November 6, 2013 7:38 PM

AJAX jQuery ASP.NET Web Pages WebMatrix Razor

There have been a few questions recently about what you can post to the server using jQuery AJAX and where to find whatever you posted. This article looks at using the jQuery ajax method in ASP.NET Razor Web Pages and explores how different options have different results.

Click to read more about Posting Data With jQuery AJAX In ASP.NET Razor Web Pages ...

Viewed 103065 times

4 Comments for this item

Saving jQuery Sortables In ASP.NET Razor Web Pages

Monday, October 28, 2013 8:04 PM

jQuery ASP.NET Web Pages WebMatrix Razor

jQuery Sortables offer a way to specify the order of a collection of items through an easy drag and drop interface. I have just been working on the next release of Web Pages CMS and am in the process of implementing Sortables for managing the display order of menu items. This article looks at how they can be used in Razor Web Pages and shows one way of saving the resulting order to a database.

Click to read more about Saving jQuery Sortables In ASP.NET Razor Web Pages ...

Viewed 23325 times

0 Comments for this item

Managing Checkboxes And Radios In ASP.NET Razor Web Pages

Monday, October 14, 2013 9:04 PM

ASP.NET Web Pages WebMatrix Razor

Checkboxes and radio buttons cause more confusion than any other form control in ASP.NET Razor Web Pages. This article takes an in depth look at them and tackles the most frequently asked questions that they generate.

Click to read more about Managing Checkboxes And Radios In ASP.NET Razor Web Pages ...

Viewed 61368 times

0 Comments for this item

Code First Migrations With ASP.NET Web Pages Sites

Wednesday, August 28, 2013 8:14 PM

Visual Studio Entity Framework ASP.NET Web Pages WebMatrix

Entity Framework Code First Migrations enable changes to your model to be propagated to your database through code. Prior to the introduction of migrations, changes to the model resulted in the database being recreated from scratch with attendant loss of data. During development, this may not cause too many problems, but once the database has been deployed into production, it's another story. Migrations solve the problem in that changes are applied to the database schema without loss of data.

Click to read more about Code First Migrations With ASP.NET Web Pages Sites ...

Viewed 51907 times

5 Comments for this item

Windows Authentication With ASP.NET Web Pages

Wednesday, August 7, 2013 7:34 PM

ASP.NET Web Pages WebMatrix

The default authentication mechanism built into ASP.NET Web Pages site templates is Forms Authentication via the SimpleMembershipProvider, which is designed to enable authentication of users against a database. This requires the user to know their user name and password, and to enter those whenever they want to log in to access restricted areas within a site. If you are using the ASP.NET Web Pages framework to build an Intranet site that will be hosted within your own corporate network (i.e. client machines and web server are in the same domain), you can use Integrated Windows Authentication instead which simplifies authentication dramatically.

Click to read more about Windows Authentication With ASP.NET Web Pages ...

Viewed 80149 times

8 Comments for this item

Implementing Customers Also Bought In ASP.NET Web Pages

Thursday, August 1, 2013 3:32 PM

ASP.NET Web Pages WebMatrix Razor

Most successful e-commerce sites implement a mechanism that draws the customer's attention to other products that might be of interest to them. These products are selected on the basis that shoppers who purchased the item currently being viewed by the customer also bought other products. This article looks at a away of implementing this kind of facility in an ASP.NET Web Pages site.

Click to read more about Implementing Customers Also Bought In ASP.NET Web Pages ...

Viewed 14740 times

5 Comments for this item

How To Check If A Query Returns Data In ASP.NET Web Pages

Wednesday, July 3, 2013 2:01 PM

ASP.NET Web Pages WebMatrix Razor

If you execute a query against a database, you need to know if any data was returned. But what is the best way to test for the presence of data when using the Web Pages Database helper?

Click to read more about How To Check If A Query Returns Data In ASP.NET Web Pages ...

Viewed 31105 times

10 Comments for this item

A CKEditor File Browser For ASP.NET Web Pages

Thursday, May 16, 2013 2:00 PM

ASP.NET Web Pages WebMatrix Razor

CKEditor is one of the most popular rich text editors available. Out of the box, there is no file browser to help with selecting images, but you can purchase an add-on from them - CKFinder. Alternatively, you can build your own file browser component.

Click to read more about A CKEditor File Browser For ASP.NET Web Pages ...

Viewed 21447 times

5 Comments for this item

Adding A Footer To The Razor WebGrid

Monday, February 25, 2013 7:43 PM

ASP.NET Web Pages WebMatrix Razor WebGrid

Whether you are using the Razor WebGrid in an ASP.NET Web Pages site, or an MVC application, you may well want to display tabular data at some point in which case you are likely to turn to the Razor WebGrid helper. And if you want to do that, you might also want to add a footer to the rendered table. Here are some ways that you can accomplish that task.

Click to read more about Adding A Footer To The Razor WebGrid ...

Viewed 43397 times

0 Comments for this item

Razor Web Pages E-Commerce - Adding A Shopping Cart To The Bakery Template Site

Friday, February 15, 2013 7:31 PM

ASP.NET Web Pages WebMatrix Razor

The ASP.NET Web Pages Bakery template site is designed as a starting point for a site that displays products. It also features an order form for customers to specify a quantity for a specific product and provide their shipping address. The site doesn't provide for multiple product selection. If you want a shopping cart for the Bakery site, you need to create it yourself. This article looks at the design considerations behind an effective shopping cart, and shows how to build one.

Click to read more about Razor Web Pages E-Commerce - Adding A Shopping Cart To The Bakery Template Site ...

Viewed 43164 times

5 Comments for this item

Consuming Feeds And Web Services In Razor Web Pages

Tuesday, February 5, 2013 7:55 PM

ASP.NET Web Pages WebMatrix

Increasing numbers of businesses are making services and data available to third parties via Web Services or feeds. Data format and protocols can vary significantly across service providers, so here is a look at how to manage the consumption of a number of popular formats delivered through REST and SOAP services within a web site built using the ASP.NET Web Pages framework.

Click to read more about Consuming Feeds And Web Services In Razor Web Pages ...

Viewed 164249 times

0 Comments for this item

Recent Comments

Manas 11/27/2014 5:30 AM
In response to Scheduled Tasks In ASP.NET With Quartz.Net
Hi Mike, Thank you for awesome article. My concern is it might impact website if we use or is...

priya 11/26/2014 6:50 PM
In response to Create PDFs in ASP.NET - getting started with iTextSharp
very nice.....its save my time...

ransems 11/24/2014 12:29 AM
In response to Adding A Controller
Love the article. I dislike that the world thinks c# articles are the way to go. Love the VB, keep...

Gautam 11/20/2014 8:01 AM
In response to I'm Writing A Book On WebMatrix
Hello Mike, I read your book, loved it! However, I have a few request/suggestions: 1) an example...

Bret Dev 11/19/2014 8:39 PM
In response to The Difference Between @Helpers and @Functions In WebMatrix
Excellent post! One concern - where can you place global @Functions code within an MVC project to Is...

Rob Farquharson 11/19/2014 4:28 PM
In response to iTextSharp - Links and Bookmarks
How can I place text at an absolute position on the page? Also, how can I rotate text?...

Andy 11/17/2014 8:08 PM
In response to MVC 5 with EF 6 in Visual Basic - Sorting, Filtering and Paging
Hello I'm testing your sorting instructions above. This is great and I was able to get it to work...

Gautam 11/17/2014 5:51 PM
In response to WebMatrix - Database Helpers for IN Clauses
Hi Mike, I am very new to programming: In the above example if I want to use a delete button the...

donramon 11/17/2014 3:22 PM
In response to Entity Framework 6 Recipe - Alphabetical Paging In ASP.NET MVC
Congratulations on your new website look and the excellent articles. Thank you!...

Gautam 11/17/2014 11:26 AM
In response to Looking At The WebMatrix WebGrid
Hi Mike, I add the jquery script at the end of my html file.. when ajax attribute is added to the be...