6 items found in the Extension Method Category

HTML5 Form Helpers For WebMatrix

20 September 2012 14:56

Extension Method ASP.NET Web Pages WebMatrix HTML5

It's an odd thing: WebMatrix 2 is lauded for its support of HTML5, but the Web Pages framework doesn't include any helpers for the new HTML5 form input types such as email or color. It's fair to say that support among browsers for the new inputs is patchy at the moment, but with barely a week flying past without a new version of one or other browser being released, it won't take long for that to change. So in the meantime, if you prefer to use helpers, you have to write your own for rendering HTML5 forms.

Click to read more about HTML5 Form Helpers For WebMatrix ...

Viewed 32832 times

5 Comments for this item

Why You Can't Use Extension Methods With A WebGrid

27 January 2011 12:58

Extension Method ASP.NET Web Pages WebMatrix WebGrid

An interesting question came up recently on the ASP.NET forums. In it, the questioner was attempting to use my Chop() extension method to limit the number of characters in a WebGrid column but it wouldn't work. At first, I was a little stumped, so I tried it myself and got an error message:

Click to read more about Why You Can't Use Extension Methods With A WebGrid ...

Viewed 11940 times

2 Comments for this item

WebMatrix - Database Helpers for IN Clauses

11 September 2010 09:35

Extension Method ASP.NET Web Pages WebMatrix Razor

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....

Click to read more about WebMatrix - Database Helpers for IN Clauses ...

Viewed 24214 times

12 Comments for this item

Converting URLs Into Links With Regex

22 May 2010 22:56

C# Extension Method

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.

Click to read more about Converting URLs Into Links With Regex ...

Viewed 12961 times

1 Comment for this item

Highlighting Keywords Found In Search Results

22 May 2010 19:41

C# ASP.NET 3.5 Extension Method ASP.NET Web Forms

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.

Click to read more about Highlighting Keywords Found In Search Results ...

Viewed 44054 times

8 Comments for this item

Displaying The First n Characters Of Text

16 May 2010 09:59

C# ASP.NET 3.5 Extension Method

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.

Click to read more about Displaying The First n Characters Of Text ...

Viewed 33100 times

15 Comments for this item

Recent Comments

Ghazanfar 30/01/2016 06:43
In response to Getting Started with ASP.NET MVC 5 using Visual Basic
Nice working. Please keep it up to convert csharp code into vb.net. Its very helpful for vb...

sara 29/01/2016 09:39
In response to Simple Login and Redirect for ASP.NET and Access
Hi there, I am trying to validate and check for inputs entered. When I don't enter any inputs and...

Martin Thatcher 28/01/2016 17:28
In response to MVC 5 with EF 6 in Visual Basic - Advanced Entity Framework Scenarios
A small typo I think. In the code section that begins Function Index(ByVal SelectedDepartment As As...

Suresh_thefame 28/01/2016 08:03
In response to Sessions and Shopping Carts
Helpful....

Andrey Kurdyumov 28/01/2016 05:47
In response to ASP.NET 5: Uploading files with ASP.NET MVC 6
@Lee IFormFile has OpenReadStream(): Stream method...

Alisa 27/01/2016 18:37
In response to A Better Way To Export Gridviews To Excel
Thanks for this example! I am also asking about the date fields having to be re-formatted when the a...

Dan Buckley 27/01/2016 00:47
In response to What ASP.NET Can And Cannot Do
New to all things programming, this was very helpful and clear. Please write more....

satyabrata 26/01/2016 16:16
In response to Request.Form Is Empty When Posting To ASPX Page
Thank you....

david sanchez 26/01/2016 09:51
In response to ASP.NET MVC 5 with EF 6 - Working With Files
Thanks! This line " <img src="~/images/@Model.FilePaths.First(f => f.FileType == alt="" />" an...

Bryon 25/01/2016 15:06
In response to Windows Authentication With ASP.NET Web Pages
Was hoping this would help solve the issues I'm having. Then I saw the dates and new it was too old....