January 2006 - Posts
I put together sample code that will run on the Northwind database that demonstrates using a generic List collection as a data source for an ObjectDataSource which populates a GridView control. All you have to do is specify the connection string in Web.config
Read More...
It appears that there is a security feature built-in to the HyperLinkField that causes links that resemble JavaScript functions (i.e. java script:SomeFunction()), file paths (i.e. F:\Directory\File), and other non-URL strings not to render when using
Read More...
Below is a helper class that I use for exporting a DataGrids contents to an external file. The below code references gridViewText, but I haven't tested it out on a GridView yet as the code is from an application I'm working on upgrading. But, it works
Read More...
Accessing a resource file in .NET 2.0 is very easy without the need for a ResourceManager. Resources .
. So, if the resource file was named Resource.resx and you are trying to access a string property named Title,
Read More...
Using String.Format you can format any string. However, the last parameter that String.Format accepts is of type object. So, to add some type-safety to the mix, the following function works perfectly. VB.NET Public Function FormatString( Of T)( ByVal
Read More...
If you moderate or own a Yahoo! group, then you should be aware that there is currently a virus outbreak where somebody or several people are spamming groups by impersonating known email addresses that subscribe to the group, and even know enough to impersonate
Read More...
Yeah. 6 more days until my Maryland trip. I'm going to attend a class being taught by Charles Carroll of LearnAsp.com . I'm really excited because I will get to meet the many programming nerds that I've met via IM and other means. Maryland here I come.
Read More...
If you're like me and converting a .NET 1.1 application to 2.0, and aren't using a DataSourceControl DataSource just yet but need to enable sorting and paging, you might run into the following exceptions: When changing the page: The GridView 'GridViewID'
Read More...
Occasionally, I've glanced at the TryParse method in IntelliSense, but never gave it a test run. TryParse is actually pretty cool. It will try to parse a string and see if it can convert it to a specified data type. This is perfect for query strings as
Read More...
There's now a Delete button so you can easily delete messages you don't want to keep. Yeah! For an up-to-date listing of new Gmail features, see What's new on Gmail? Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
Read More...
Let's say for instance, you want to create a List of your own class, say Employee, where Employee represents an employee. First, we'll start by creating an employee class. [ Serializable ] public class Employee { private bool m_IsSalaried; private int
Read More...
Just found out about a site called Community Credit which gives stupid prizes to smart people. Things such as writing a blog entry will earn points. You can win prizes such as Ebola or Flesh Eating Disease (both pictured below). Now that's awesome. Share
Read More...
I was surfing the Internet today and came across David Wheeler's blog, which has some interesting entries on Generics. Anonymous methods and handling events in .NET 2.0 Generics: An introduction Generics: More advanced concepts New and improved events
Read More...
Today I came across an interesting blog entry debating the use of prefixing m_ to a variable name when naming private member variables. I feel that if there was a standard, we would all be following it. IMO, if you develop a decent coding standard, you
Read More...
Take the following code, for example: VB.NET Public Class TestClass( Of T) End Class Response.Write(GetType(TestClass( Of Integer ))) C# public class TestClass
{ } Response.Write( typeof ( TestClass < int >)); The above code results in
Read More...
Q: What's wrong with the below generic class? VB.NET Imports System.Data Imports System.Web Public Class GenericClass( Of T As DataTable) Public Function GetValue( ByVal val As T) As T Return val End Function Public Function GetValue( ByVal val As T)
Read More...
In generics, you can use sub classes just as you would any non-generic sub class. Take the following class and sub class for example: VB.NET Public Class OuterClass( Of T, U, V) Public Class InnerClass( Of T, U) Public Function InnerMethod( ByVal val1
Read More...
One of the weirder features in C# 2.0 is nullable types. My thinking is as follows: Why complicate things with Nullable
, or its shorter version of DataType? (i.e. int?), instead of allowing null values to be assigned to those data types that
Read More...