Author: jclosure
-
TSQL function to parse delimeted string and return a memory table containing the values
This script is useful when you need to generate a rowset from a delimeted string. It allows the “WHERE IN” clause to be used against the values in the string, because they are converted into table rows. This UDF is designed to be plugged into other queries where this need is present. Here’s an example of…
-
AutoFocus the UserName field of an ASP.NET Login Control
Even if you’re not using a templated version of the Login Control, the builtin TextBox for username entry can be targeted like this: protected void Page_Load(object sender, EventArgs e){ SetFocus(Login1.FindControl(“UserName”)); } SetFocus is in the Page class. Easy joy..
-
Demonstration of Dynamic Type Creation and Resolution
This is a modified sample from the .NET Framework SDK. Basically demonstrates how to programmatically drive the ILGenerator to emit code resulting in a method definition. Note that it is wrapped in a programmatically created assembly that exists only in memory. In the Main of this Application, the dynamic assembly is unwrapped and reflection is…
-
Early, Late, and Dynamic Binding and C# 4.0
Anders Hejlsberg Explains the dynamic language extensions in C# 4.0 and the problems they solve.
-
General Purpose Data Synchronization Between Objects – The Easy Way
When moving messages between systems, I’ve often found myself confronted with the need to copy values from one object representation to another. The objects may or may not have any Properties whose names and Types match, so the solution to this problem must be tolerant of incongruent data shapes. This can always be achieved…
-
Use the ASP.NET ViewState with WebUserControls’ public Properties
This technique works with WebForms, but becomes much more useful when you site WebUserControls on a WebForm and need to set/get values between the parent Form and a child UserControl. Put something like this in your WebUserCotrol1. public int Total { get { return ViewState[“intTotal”] != null ? Int32.Parse(ViewState[“intTotal”].ToString()) : 0;…