devxlogo

Tip Bank

Serialize Any .NET Object to a JSON String

The following steps explain how to serialize any .NET object into a JSON string. This tip uses the .NET 3.0 Framework. You’ll find this capability particularly helpful in applications that

Retrieving Table Size in SQL Server

The following SQL query returns the size of each table in the specified database. USE sp_MSforeachtable @command1=’EXEC sp_spaceused ”?”’,@whereand=’or OBJECTPROPERTY(o.id, N”IsSystemTable”) = 1′ Here’s how it works. SQL Server’s system

Detect Recursive Calls in Your .NET Code

Here’s a way you can check whether the current method is recursive. The following method returns True when your application is in a recursive method: Public Function CheckRecursion() As Boolean

Add an Image Command Field to a GridView at Runtime in ASP.NET

It’s relatively easy to add an Image Command Field to a GridView programmatically. Here’s how: // in C#if (!Page.IsPostBack){ CommandField field = new CommandField(); field.ButtonType = ButtonType.Image; field.SelectImageUrl = “~/Images/MyPic.GIF”;