views:

32

answers:

1

OK, so I'm trying to create a template item from a web form.

I have referenced this article: http://www.west-wind.com/weblog/posts/740022.aspx and it exports the template and installs it fine.

When you try and use the template item within a project though it leaves the inherits="_Default" in the page directive like shown below:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="FormTemplateDev.aspx.cs" Inherits="_Default" %>

So it thinks all the new template items use the original form name pre-template generation. This is an issue in the code behind too as shown here:

public partial class _Default : System.Web.UI.Page 

I have seen example of passing paramater strings through but havent managed to get anything to compile. I found something like below:

public partial class $safeitemname$ : System.Web.UI.Page

Does anyone have any suggestions?

This was the link to the list of available template parameters i found:

Project Template Parameters

A: 

OK so It is as simple as this:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="FormTemplateDev.aspx.cs" Inherits="$safeitemname$" %>

and...

public partial class $safeitemname$ : System.Web.UI.Page

It threw me because the page won't compile and the page turns red with rage! This means you will have to put these $slightlystrangeparameters$ in once you have got your template item completed and built. Add the parameters in and export it as a template.

Hope this helps someone else...

Andi