AppSettings for ASP.NET Controls

[Infragistics] Murtaza Abdeali / Wednesday, April 15, 2009

While you are still exploring the contents of 2009 Volume 1 release, in this post I will be talking about a couple of items that you might find useful. In this release, we’ve exposed an appsettings object that can help you in your day to day development and make some of the page level or application level tasks easier. This appsettings object contains a flag IsAjaxPostBack, this flag is set to true whenever an ajax call is being made by any of our ASP.NET AJAX control. This way you have one flag that you can check to filter out the code you do not want to run if a call is being made internally by a control.


It also contains an object for the AppStylingManager which holds all the settings and configuration for application styling. If you are using application styling, this object lets you enable/disable styling for your entire application using the EnableAppStying flag, or set the StyleSetPath and/or StyleSetName to change the look and feel. You can also use the Web.Config to set it as in the past.  

It also has a CSSRegistry object which allows you to register your own CSS class in code and render it within your page. This helps when you don’t know if you will need a certain CSS class on the page, or want to convert an inline style to CSS. Let’s take a look at an example on how you can use the object to convert a WebControls.Style object to a CSS class on the page. 


And when you run the page, you see the following CSS automatically added to your page. You can then apply this CSS style to any control or html element via a CSS property or a "class" attribute.  The element or control will pick its appearance based on the CSS class you registered on your page.

We will be enhancing this object further and include more configuration settings that you can set on a application or page level. If you use a control level setting frequently that you wish was a one-time setting for your application or a page, or have any other suggestions, please feel free to send it to me at:

Happy Coding!