calendar_today 05 July 2018 13:27
In my last article, I looked at the experimental Blazor framework, using Cascading Dropdown Lists as an entry point. Since then, some feedback from Steve Sanderson to a question I asked has shown me a better way to implement this pattern.
calendar_today 17 July 2015 13:43
Every time I need to work with the contents of text-based files in an ASP.NET application I invariably start off thinking about using the various static methods on the
System.IO.File class to extract the text and then some string manipulation or Regex to parse the content into some kind of structure. And, just in time, I remember the
TextFieldParser class that hides itself away in the
Microsoft.VisualBasic assembly. The purpose of this article is to introduce this component to a wider audience, but also to serve me as an aide-mémoire in terms of the basic usage, which I always have to look up.
calendar_today 14 April 2015 13:25
Visual Studio 2015 introduces a completely new version of ASP.NET, but it also includes version 6 of the C# language. Previous new versions of C# have heralded substantial changes like the introduction of
await in version 5,
dynamic in version 4, LINQ in version 3 and so on. There are no major feature changes or introductions in version 6, but there are a number of syntactical improvements that you are likely to use on a daily basis. Here's a rundown of them.
calendar_today 22 January 2015 13:54
The number of places where you might use or encounter the
@ sign in ASP.NET has grown over the last few years and its exact purpose in all circumstances still seems to cause confusion. Here's an overview of the most common places that it crops up, and guidance on its correct usage.
calendar_today 12 September 2010 08:14
I've had a review copy of Jeffrey Richter's CLR via C#, Third Edition for some months, and it has taken until now to get round to publishing my thoughts on the book. It's not my fault. I blame the book. It made me forget why I was given a copy in the first place. Let me explain...
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 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 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 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 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 05 January 2009 13:54
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 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 06 June 2007 23:15
The contents of an RSS feed only change when items that appear in it are added or amended, so the feed created in the previous article (Create an RSS Feed In ASP.NET 2.0 C#) is rather inefficient, in that the output is generated everytime the feed is requested. Here's an improvement.
calendar_today 29 May 2007 12:37
Some basic file and folder management tasks that require the use of classes inside System.IO
calendar_today 28 May 2007 21:18
A Cheat Sheet containing the VBScript string functions and their equivalent methods in C#.
calendar_today 24 May 2007 22:01
The is a brief overview of the main classes and methods in the System.Text.RegularExpressions namespace. It doesn't cover Regex patterns in any real depth at all, but gives an introduction to the power of regular expressions using C#.
calendar_today 21 May 2007 21:38
Two classes in the System.Net namespace make it very easy to obtain the html of a remote web page. These are the HttpWebRequest and HttpWebResponse. Here's a quick demo.
calendar_today 20 May 2007 20:21
Examples of splitting strings into arrays using C# and VB.Net, both with the String.Split() method, and the Regular Expressions Split() method.
calendar_today 19 May 2007 20:36
Cheat sheet for C# regular expressions metacharacters, operators, quantifiers etc
calendar_today 16 May 2007 10:06
For the main part, the DataSource controls are incredibly easy to work with. You just drag them onto your page in Design View, wire them up to a connection and provide some kind of command (ad hoc sql query or the name of a stored procedure - saved query in Access), then link them to a databound control on the page using its DataSource property. Then you run the page and all your data appears. But what if you want to get at one or more values from the returned data to do something else with it, like display it in a control that doesn't expose a DataSource property?
calendar_today 10 May 2007 22:53
Using ASP.NET to send the contents of a form by email is a common requirement. This sample looks at generating an email using System.Net.Mail in both plain text and html format from a very basic Contact Us form.
calendar_today 06 May 2007 20:50
calendar_today 06 May 2007 20:38
calendar_today 27 April 2007 21:49
Need some bit or all of the URL for any reason?
calendar_today 09 April 2007 21:44
Long articles are better broken into bite-sized chunks over several pages. With static HTML, this is easily achieved by dividing the article into logical separations and creating separate .htm files for each. Here's how to do it using C# for an article that gets posted to a database.
calendar_today 08 April 2007 21:11
Cheat sheet detailing formatting options for dates and times in C#.
calendar_today 06 April 2007 19:55
Many newcomers to web development cannot get their head around why the carriage returns they made in their data on input from a textarea, or from a text file, Excel spreadsheet etc. do not appear when the web page renders.
calendar_today 05 April 2007 22:37
Using the XmlTextWrite to output an XML file that serves as an RSS feed.
calendar_today 03 April 2007 21:33
In Classic ASP, the typical model for managing site-wide functions is to create one or more server-side includes containing libraries of code. The OOP nature of ASP.NET offers a much more elegant solution.