Archive for the '.Net' Category

T4Configuration: Small July Update

T4Configuration is a T4 template that generates a static class with methods derived for the appSettings and connectionStrings sections of either your Web.Config or your App.Config files.

I made a small update that lets the namespace be derived from Visual Studio 2010 assemblies instead of the reliance on the third-party T4 Toolbox. This should fix it not working if the user does not have it installed (Doh!).

Continue reading ‘T4Configuration: Small July Update’

T4Configuration: Automated .Config settings

UPDATE: T4Configuration has been updated see here for info.

UPDATE: Source code is available at https://github.com/tornal/T4Configuration

I have created a quick and dirty T4 script to run in Microsoft Visual Studio that will automatically generate a static C# class with properties for every <appSetting> and <connectionString>. You can then access them like so:

 1: String conn = Config.MyDataContext;

Not a million miles away from how T4MVC works.

It is a simple little utility that I hope automates something a lot of us do or have built a shared library to do.

Source code will follow soon. Its all on a BSD do what you will license.

Get it through Nuget or type “Install-Package T4Configuration” in your package manager console.

 

Report Viewer Control 2010 – Setting height to browser window across multiple browsers

When you add a Report Viewer control to your Asp.Net site the height will default to 400 pixels. In many situations you want the control to automatically fill to either the browser window or at least its containing block element. Setting it to 100% works for width but will not work for height. This is down to the DOCTYPE of the web page specifying XHTML and 100% height for the table is an illegal attribute.

Continue reading ‘Report Viewer Control 2010 – Setting height to browser window across multiple browsers’