CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

Templates going haywire (There is already a component named ....)

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

 



Comments

Peter van Ooijen said:

Brendan, that's cool. But to customize the template I still have to use the template editor.
Your story shows it's all about usercontrols. I've been playing with them a little more and found it very easy (and fast) to drop a user control on the template and handle all program logic inside the user control. More on that in an article I'll submit to the dnj.
# January 22, 2004 1:43 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

This Blog

Syndication

News