Dynamically loading ASP.NET 2.0 “Bindable” templates

Update: See http://weblogs.asp.net/james_crowley/archive/2005/09/06/424539.aspx

Just found out that ASP.NET 2.0 doesn’t support dynamically loading “bindable” templates from a file; you’re restricted to writing them inline. In other words, if you’re using a FormView or DetailView control, and plan to use the new two-way data binding features, any use of LoadTemplate is out of the window. Plus the BindableTemplateBuilder (for creating a two-way data bound template on the fly) is currently an internal class. Which seems a big shame… (or maybe it’s just me??)

Does anyone know of any potential ways around this?

(Since finding this out, I’ve put in a request to at least make BindableTemplateBuilder a public class here).

2 thoughts on “Dynamically loading ASP.NET 2.0 “Bindable” templates”

  1. I tried the workaround but it comes up with this error:

    “Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.”

    Which makes sense.. and adding a DataSourceID attribute to the FormView control doesn”t fix this. Any thoughts?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.