Handle Multiple Columns as One with Dynamic Data

Sometimes you need to schedule tasks in ASP.NET and save both a Start Date and an Interval, stored respectively as DateTime and TimeSpan.Ticks in your database. Editing raw tick values is not exactly good UX, so I bound the proper MetaColumn to the proper UIHint. After some tests, I noticed the GUI was functional but not as intuitive as expected. The solution was to customize the FieldTemplateUserControl of Dynamic Data, to display and save multiple columns I needed (Start Date, Start Time, Occurs – Daily, Weekly, Monthly, etc.). ...

November 2, 2008 · 1 min · Andrea Azzola

Set the ConnectionString at Runtime with DynamicData

Note (2025): This article dates back to 2008 and refers to ASP.NET Dynamic Data, which is legacy today. Concepts can still be useful historically, but for modern .NET consider newer frameworks and data‑binding approaches. The following snippet customizes the .NET ConnectionString at runtime in a Dynamic Data application. Edit Global.asax and modify the RegisterRoutes(RouteCollection routes) method. Instead of: model.RegisterContext(typeof(XYZDataContext), new ContextConfiguration() { ScaffoldAllTables = true }); Use: model.RegisterContext( () => new XYZDataContext(connectionString), new ContextConfiguration { ScaffoldAllTables = true } ); Where connectionString is your string value. You can customize the RegisterRoutes parameter collection without compromising application functionality. ...

June 16, 2008 · 1 min · Andrea Azzola