New C# 6 Features

C# 6 makes coding even easier.  Watch how Michael Palermo guides the discussion by comparing previous approaches to common tasks with new ways introduced in version 6.  Features covered include auto property initializers, properties with expression bodies, methods with expression bodies, string interpolation, using static, and nameof operator.  Demo of code is presented in a simple ASP.NET…

0

A Better FindControl Method

For ASP.NET web forms developers, this is a handy extension method of the Control class that returns a strongly-typed control instance from a deep recursive search at any point in the control tree hierarchy: public static partial class ControlExtensions {     public static T FindControl<T>(this Control currentControl, string id) where T : Control  …

1

Increase Web Site Scalability Using CompilationMode

Did you know that ASP.NET Web Sites allow developers to configure whether a page compiles or not.  Consider the following page directive: <%@ Page Language=”C#” CompilationMode=”Never” %> Setting the CompilationMode attribute to Never will disallow code on the page.  It will also prevent compilation to an assembly.  These pages can contain server controls or Expressions such as…

0

AJAX Extension Methods

Although the ScriptManager has a property named IsInAsyncPostBack to determine an AJAX call, the control is scoped to the page it is contained in.  If writing code in a custom HTTP module, what if I need to know in the BeginRequest event whether the current request is AJAX or JSON? How nice it would be…

0