Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Definig Custom Item Templates in VS 2005 Web Projects

Posted on 2007-03-21
3
Medium Priority
?
341 Views
Last Modified: 2013-11-26
Hi there

I am trying to create a custom item/page template for my web project in VISUAL STUDIO 2005. I am using the following article as a basis:

http://weblogs.asp.net/scottgu/archive/2005/09/09/424780.aspx

The problem I am getting is that the Marker I am setting in the inherits property of the aspx file and the class name in the aspx.cs file are not being substituted with the file name that I designate when I use the template to add a new web page to my project.

The marker is setup as follows:

ASPX file:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="default_template.aspx.cs" Inherits="$pagename$" Title="Untitled Page" %>


ASPX.CS file:
public partial class $pagename$ : CustomBasePage

When I create my new web page using the template, the "$pagename$" remains meaning I have to manually edit it rather than it substituting automatically when the page is created.

Anyone know why this might be happening?

Cheers
0
Comment
Question by:yvsupport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Webstorm earned 1500 total points
ID: 18765696
Hi yvsupport,

Your template must use specific marker name
see http://msdn2.microsoft.com/en-us/library/eehb4faa(VS.80).aspx

So, use $safeclassname$ instead of $pagename$
0
 

Author Comment

by:yvsupport
ID: 18769957
Hi there

I didn't know those names were specifically defined. I tried $safeclassname$ but that didn't work either so I tried $safeitemname$, which is the one used in the article that I mentioned in my original post and amazingly it works. Much strangeness ..... Anyway, I shall mark your comment as the solution as you certainly pointed me in the right direction :)

Cheers
0
 
LVL 13

Expert Comment

by:Webstorm
ID: 18779944
In fact, the template parameter name depends on which action will generate the value :
$safeclassname$  when you add a new class
$safeitemname$  when you add a new item
...
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question