devxlogo

Tip Bank

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”;

The Best Way to Hide a Column in a DataGrid

Typically, developers hide a DataGrid column by getting the index of the column to be hidden, and then hiding it in the ItemCreated event as follows: e.Item.Cells[myColumnIndex].Visible = false; That

Use Array Predicates to Simplify Searches

Array predicates are a not-so-well-known feature introduced with the .NET Framework 2.0 that let you retrieve specific items or perform operations on all items of an array. For example, a

Generate Metatags for ASP.NET Pages Dynamically

You’re probably already aware of the benefits of metatags, which provide metadata about an HTML document. Metatags aren’t rendered in the browser, but search engines use them to categorize web