Development – Leet 4 Life

Software Development Code Samples and More

Skip to: Content | Sidebar | Footer

Category: Environments

Serializing NameValueCollection to JSON in ASP.NET MVC Web APIs

10 June, 2013 | ASP.NET, C#. NET | By: Michael Merrell

Recently I had the need to serialize a NameValueCollection object through MVC’s WebAPIs. However the inherit object that is provided in the Specialized Collections .NET Framework does not play nicely with JSON serialization. Because of this I ended up have to write my own set of custom classes for serializing NameValueCollection from JSON to be used inside the functionality of my Web APIs. This code is simple and gets the job done very well. Then the client side JavaScript: Read more about my problem of Serializing NameValueCollection to JSON using MVC Web API

HTML5 Canvas and ASP.NET Image Control

5 December, 2012 | ASP.NET, HTML5 | By: Michael Adams

I was playing with the HTML5 Canvas element trying to allow client side zooming/panning/rotating of an image. I finally figured out an implementation that will accommodate the zooming and I am still working on the panning/rotating pieces of the functionality. I use a SELECT element to act as the scale (Zoom) for the image. Even though it is not present in the code snippet below, I use a Generic Handler to populate my ASP.NET Image control. The HTML5 canvas uses the ASP.NET Image control as the source of the image and then I can use JavaScript and the Canvas element [Read More…]

JQuery And ASP.NET Gridview

21 November, 2012 | ASP.NET, jQuery | By: Michael Adams

I was in a situation where I was expanding the functionality of an existing ASP.NET Gridview and I needed to add on-click highlighting and double-click redirecting. I was browsing the JQuery website for a general idea on what to implement when I eventually pieced this together: The JQuery: In the click function I use JQuery to set a class that will change the row background and text color to help the user identify which row was selected. In the dblclick function I use JQuery to look up an id that is stored in a template column in the gridview. That [Read More…]

Enable CLR Sprocs in MSSQL

31 October, 2012 | SQL Server, T-SQL | By: Michael Adams

Recently I inherited a project where the developer was using CLR stored procedures in Microsoft SQL Server. I found out that you must execute the following SQL Script to be able to use those stored procedures. This statement simply enables Common Language Runtime integration feature for the entire SQL instance that you are currently on. The CLR Integration feature is off on a new SQL Server instance by default so in order to use it you must run this statement. To enable this setting you must have the alter settings server level permission on the user account that you are [Read More…]

Find all Tables With Schema that Contain a Column by Name

29 October, 2012 | SQL Server, T-SQL | By: Michael Merrell

Sometimes you need to find tables that contain a specific column name. Maybe you want to find all the tables that have a User_ID column. This was my case when I came across writing this statement although it can be used for any cases where you need to find tables that contain a specific column. It ends up being a very simple query to the sys.objects and sys.columns tables using a join. First you query from the sysobjects table and find all objects that are type ā€˜Uā€™ which stands for User Table. Then you join to the syscolumns and find [Read More…]