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.
calendar_today 03 May 2010 23:36
Managing shopping carts using Sessions is the source of much confusion for beginners to ASP.NET. This article looks at how to do this so that items can be added and removed by customers easily before they commit to their purchase.
calendar_today 22 February 2010 21:53
It seems that the whole world (and Margate) is having its say on which is better - MVC or Web Forms. Scott Guthrie posted his views on technical debates in general, and then contributed his thoughts on MVC v. Web Forms. Ian Cooper has an interesting contribution to make to the debate too. Rob Conery (formerly of Microsoft) posted probably the most linked to opinion on the matter. (There - I've just added another link...) A lot of other blog posts around scream that MVC is better because its better. One even tries to posit the notion that some kind of score card approach can help you decide.
calendar_today 10 February 2010 07:28
The most recent addition to my Cheat Sheets features details of all the Exceptions that can be found in the most commonly used assemblies within ASP.NET development. Compiling this information was an interesting challenge. I could have simply copy-pasted from MSDN, but that would have been extremely tedious. Instead, I ended up with a blend of Linq to XML, Reflection, a dash of Regex and the Global Assembly Cache Tool - gacutil.exe. Here's the full story.
calendar_today 07 February 2010 17:19
Here's a list of Exceptions that can be found in the assemblies which are most commonly used in ASP.NET development. Ideally, you should be as specific as possible when catching or throwing Exceptions. The more specific you are, the less work the CLR has to do in locating the appropriate catch block, and the more informative your error messages are, which should help speed up identifying the source of any problems.
calendar_today 30 January 2010 22:22
A frequent requirement for ASP.NET developers is to schedule tasks at regular intervals. This can include site maintenance tasks, like cleaning up old files, emailing newsletters on a schedule etc. This article examines one easy option for managing tasks like these without having to configure external tools, and discusses a couple of alternatives.
calendar_today 06 December 2009 19:46
Should you store files and images in the database or the filesystem in an ASP.NET application? With SQL Server this is a dilemma, with both approaches having their pros and cons. When it comes to Access, the decision is much easier to make. Because an Access database is restricted to 2Gb, it makes more sense to store files in the file system. However, sometimes, you may not have the choice. If you have to use the database, here's how.
calendar_today 25 November 2009 09:09
When it comes to protecting files from unauthorised downloading, the vast majority of articles offer solutions that involve mapping common file types (.pdf, .txt, .doc etc) to ASP.NET within Internet Information Services. However, often in a shared hosting environment, you don't have access to IIS and the hosting company will not agree to providing such mappings for you, so what do you do?
calendar_today 23 November 2009 22:26
If you are new to web development and choose ASP.NET Web Forms as your starting point, you may be forgiven for not understanding how ASP.NET works, and what its role is. This article covers the basics which should help you discover your limits.
calendar_today 28 October 2009 15:49
I reviewed an ASP.NET Architecture and Design book recently. It was OK. I felt it was a bit thin, and didn't cover topics beyond beginner level. Then I got sent a review copy of another book: Professional Enterprise .NET. Having read it, this is the book that the previous book should want to be when it grows up.
calendar_today 26 October 2009 22:30
If you have a Google Analytics account, you can use the Data Export API provided by Google to access your visitor stats, and retrieve them for use elsewhere. Here's how to display some stats in ASP.NET.
calendar_today 11 October 2009 18:36
Back in the day, when I began to get interested in ASP.NET application architecture and design, I spent hours hunting for a book that would explain all I needed to know. I wanted one that focused on ASP.NET, with its special demands, rather than a general .NET development book. I wanted a book that would explain what layers and tiers were, and how I should separate code out to make it more scalable and reusable. I wanted a book that would explain how I could take my skills to the next level. I couldn't find one. There was a big gap in the market. Vivek Thakur has attempted to fill this gap, with this apty named title: ASP.NET 3.5 Application Architecture and Design.
calendar_today 28 September 2009 21:53
Since my article on using parameters for Preventing SQL Injection In ASP.NET, I have had a few emails asking how to do the same with an IN clause expression. In this entry, I explore a couple of ways to do this.
calendar_today 19 August 2009 07:28
I, and many other contributors to the forums at www.asp.net find examples of code posted on a daily basis that are vulnerable to SQL Injection attacks. We continue to exhort beginners (and some more experienced programmers) to code against them. This article examines just how serious a flaw vulnerable coding can be, and what you should do about it.
calendar_today 29 May 2009 15:58
calendar_today 04 May 2009 18:39
I've recently done a series of articles that feature calling databases via AJAX using jQuery. In pretty much all of the articles, I have used Web Services as my data access mechanism. Judging from the comments that some of the articles have attracted, this has caused a little confusion. But Web Services is just one mechanism. Page Methods and simple ASPX files are two more. And finally, as pointed out by a commenter, Benny Halperin, ASHX files are yet another option. In this article, I shall review each of these approaches.
calendar_today 14 April 2009 22:39
IP addresses can reveal a lot about your web visitors. For an ecommerce site, the owner or registrant of the visitor's IP address can be very useful information. You could paste each visitor IP address into one of the many free IP Lookup sites available, but that can be time-consuming and tedious. Or you could build your own lookup. This article shows how this can be done pretty quickly.
calendar_today 02 March 2009 07:30
This article looks at efficient use of jQuery tabs when displaying data. Specifically, it covers how to lazy-load data, so that it is only accessed and displayed if the tab is clicked.
calendar_today 04 February 2009 22:29
It was bound to happen - you knock up an article on jQuery draggables one day, and the next, someone like Jim ;-) comes along and asks about persisting the position of the dragged item across Postbacks, or even sessions. I suppose it's my fault - I mentioned using draggables in a previous life in the context of saving the position, so it's only fair I share how that's done.
calendar_today 01 February 2009 08:12
One of the keystones of modern AJAX-enabled web sites is Drag and Drop. This article looks at the current state of Draggables that form part of the jQuery UI Library.
calendar_today 24 January 2009 18:18
It's a common problem: you have a registration form, but you want to prevent user names or other values from being used more than once. You need a user-friendly way to prevent duplicate values being submitted. This is where the simplicity of jQuery excels.
calendar_today 13 January 2009 08:47
Cascading DropDownLists or dependent dropdowns are the signature dish for AJAX applications. I spent quite a while fiddling to try to get some to work, before stumbling across a life-saving jQuery plugin that makes working with DropDownLists on the client-side a breeze. This article shows how it all works, and makes use of the WebService I introduced in my previous jQuery article.
calendar_today 10 January 2009 09:09
There appear to be many articles showing how to use jQuery with ASP.NET Web Services around, but the vast majority of them illustrate the use of PageMethods that return a single value - typically "Hello World!" or the current date and time. Not much use in the real world, where you may more often need to call a service that returns a collection of complex objects. Here are a couple of examples that look at playing with more than just simple values.
calendar_today 05 January 2009 13:54
calendar_today 31 December 2008 09:32
Over Christmas, I had a bit of spare time, so I decided to add some functionality to this site. One of the things that I added was the ability for people to post comments about specific articles, and you will see that a form has been added at the end of this article. The other thing I have been meaning to get round to is to add a Google Site Map. I believe I have created my site to be as friendly to Google's bots as possible, but there is no harm in submitting a site map to guarantee that Google knows about all the pages I want indexed.
calendar_today 25 December 2008 14:18
calendar_today 13 December 2008 21:47
Getting odd results and unexpected errors when working with Dates and Times in Access through ASP.NET is a common problem. Here's an overview of the Access DateTime data type, and some resolutions to the more frequently encountered errors.
calendar_today 07 December 2008 19:33
Delegates in C# cause a fair amount of confusion, but with the introduction of LINQ to SQL and the profilic use of the Lambda Expression operator (=>) that it has foisted on an unprepared batch of beginners, an understanding of how these two items are related, together with Anonymous Methods becomes more important. Most definitions of Delegates that you find start off with comparing them to "function pointers in C or C++", which is great if you ever worked with those languages and understood them, but not helpful to new programmers. Here's my attempt at simplifying the various concepts.
calendar_today 28 November 2008 13:38
Many times, I have seen questions about where to obtain Charting controls for ASP.NET web applications, and until recently, the answer has always been to have a look at many of the third party offers that are available from the leading control development companies. That is until Microsoft released their Chart Controls for both Windows Forms and ASP.NET to work with .Net 3.5 SP1.
calendar_today 24 November 2008 07:41
I have now covered many of the basics involved in generating PDF files from ASP.NET using iTextSharp in the series of articles listed below. This article will look at additional ways to provide formatting to documents through the use of columns.
calendar_today 17 November 2008 12:30
The previous iTextSharp article looked at bringing images into a PDF file and working with them. Sometimes, however, you may want to draw shapes and lines within the PDF and not rely on images. iTextSharp includes a lot of functionality that covers simple drawing to quite complex shapes. This article gets you started. Previous articles are listed below:
calendar_today 07 November 2008 23:00
The seventh article in my iTextSharp series looks at working with images. This article builds on the previous six which are listed below.
calendar_today 03 November 2008 07:34
Tables will probably be one of the most used elements in PDFs generated from ASP.NET applications to provide the structure for documents such as orders and invoices. This overview is not an exhaustive examination of tables, but provides an introduction to working with them through iTextSharp, and builds on the previous articles in this iTextSharp series:
calendar_today 26 October 2008 11:01
Over the years, I have picked up and read many Beginners books that attempt to get someone started on the road to building web sites with ASP.NET. Nearly all of them assumed that their readers know more than they might. Some of them seem to assume that all readers are upgrading from one version of the .NET framework to another, while others assume that you already know about core web development technologies such as HTML, CSS, C# or VB etc. I well remember being frustrated with my first book, in that it didn't give me enough basic information to get started with web development, let alone web development with ASP.NET. Now, up steps Imar Spaanjaars, with his effort: Beginning ASP.NET 3.5 in C# and VB (Wiley/Wrox, ISBN: 978-0-470-18759-3).
calendar_today 23 October 2008 21:51
Interactivity within PDF documents is enabled though Anchors (links) and Bookmarks. Following earlier articles in my iTextSharp series, this particular contribution will introduce the basics of linking and bookmarking PDF documents created via iTextSharp. You may want to review earlier articles in this series, if you haven't already done so.
calendar_today 20 October 2008 08:32
Having already looked at how to create a PDF document with iTextSharp, set fonts and their styles and add text, this article turns its attention to lists. Ordered and unordered lists will be covered. You may want to review earlier articles in this series, if you haven't already done so.
calendar_today 18 October 2008 22:32
This is the third in a series of articles that looks at using the open source component, iTextSharp from within ASP.NET to generate PDFs. Just as HTML and ASP.NET provide containers for varying ampounts of textual content, iTextSharp offers the Chunk, Phrase and Paragraph classes. Before going on, if you would like to read earlier articles, they are:
calendar_today 15 October 2008 22:07
Following on from my introduction to iTextSharp, the free PDF utility that lets you work with PDF files within ASP.NET, this article looks at working with fonts in PDF documents that you create. If you haven't read the first article in this series, I recommend that you do so now.
calendar_today 12 October 2008 11:26
The .NET framework does not contain any native way to work with PDF files. So, if you want to generate or work with PDF files as part of your ASP.NET web application, you will have to rely on one of the many third party components that are available. Google will help you to find one that fits your budget, as well as a range of open-source free components. One of the free components is iTextSharp, which is a port of a well known Java utility, iText.
calendar_today 30 April 2008 22:48
The unbelievably cryptic Operation Must Use An Updateable Query error is the bane of developers who are just starting out with Access and ASP.NET. You've done your code, plopped your database file in the App_Data folder (or at least, you should have done), and try to run a page that INSERTs or UPDATEs records, and it all stops dead. This brief article explains the cause of the error, and the steps required to stop it recurring.
calendar_today 20 November 2007 22:54