Sometimes the template editor in VS messes things up. After clicking “edit template” a horror like this might show up:
This is fixable : When you drop a control, like a textbox or label, on the page VS will create a declaration for the control in the code file behind the page. In a control which works with templates, like a datagrid or a datalist, the controls in the template are not added to the code. (In my dnj article on the datagrid I described how to get to the template’s controls from code nevertheless…) What happened in the screenshot is that VS.NET did create declarations for all the controls in the code behind source file. Deleting (commenting out) the declarations from the source will get the template editor working again.
I don’t really like the template editor that much. When a template is opened VS creates a class based on this page containing the template and the html source of the template. Probably comparable to the things asp.net does in IIS when a full page is requested. In the process of editing a template VS keeps doing things in the background, so much that it can cripple any machine. Editing templates is not the “experience“ of editing a normal page. At this moment I’m exploring user controls as an alternative, but still have some hurdles to take …
blog on, Peter