.NET Framework 2.0 SP1 - TagMapping Undocumented hotfix

While searching a way to solve the HtmlControls tag mapping problem I found that the new SP1 bring an extra undocumented hotfix.

This undocumented hotfix changes MainTagNameToTypeMapper.GetControlType method so that, for every tag name regardless is kind, a tag type mapping is always performed.

This little change enables us to tag map HtmlControls the same way we map WebControls and UserControls. Here is an example: [more]

<system.web> <pages> <tagMapping> <add tagType="System.Web.UI.HtmlControls.HtmlForm, System.Web, Version=2.0.0.0" mappedTagType="tagmapping.controls.Form, tagmapping" /> </tagMapping> </pages> </system.web>


This tag mapping problem is also fixed for .NET Framework 3.5.

For those of you who still use .NETFX 2.0 without SP1 the only solution I found available is:

<system.web> <pages> <controls> <add tagPrefix="html" namespace="System.Web.UI.HtmlControls" assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </controls> <tagMapping> <add tagType="System.Web.UI.HtmlControls.HtmlForm, System.Web, Version=2.0.0.0" mappedTagType="tagmapping.controls.Form, tagmapping" /> </tagMapping> </pages> </system.web>


Then you should replace the <form> tag with an <html:HtmlForm> tag in your pages.


kick it on DotNetKicks.com

No Comments