开发者

I need to know how to create a custom webform template in ASP.NET that allows me to pick a master page

Using Visual Studio 2008, I need to create a custom web form that when picked acts like the web content form, by providing a dialog that lets you pick a master page. I have looked through the webform.zip temp开发者_开发问答late and thought I had a clue, but trying different combinations has baffled me as it either doesn't appear or doesn't work.

Also when you set the project type to Web and sub project type to CSharp it doesn't appear, so I don't know if this part of the cause, because I would of hoped that the SupportsMasterPage element would of caused this dialog to appear, if it is a web item, but no luck. Frown

Any ideas?

p.s. I have used my googling resources to the maximum so unsure what to do.


If you're using a website, then a web form template with the key: SupportsMasterPage is what you're looking for:

<VSTemplate Version="3.5.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2008" Type="Item">
  <TemplateData>
    <DefaultName>myfilename.aspx</DefaultName>
    <Name>myPageName</Name>
    <Description>My description</Description>
    <ProjectType>Web</ProjectType>
    <ProjectSubType>VisualBasic</ProjectSubType>
    <SortOrder>10</SortOrder>
    <Icon>__TemplateIcon.ico</Icon>
        <SupportsCodeSeparation>true</SupportsCodeSeparation>
        <SupportsMasterPage>true</SupportsMasterPage>
  </TemplateData>
</VSTemplate>

If you have a web appliction project, you'll need the to use a template for the Web Content Form. I don't have a code sample for that exact template, but it should not be much different if at all.

Also, to get your template to appear they have to be zipped and loaded into the templates directory on your system:

%myDocuments%\Visual Studio 2008\Templates\ItemTemplates\

And they need to be loaded into the appropriate language/sub folder.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜