Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 5th, 2013, 11:30 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating custom item templates for my web app

I've got a web app project that I'm looking at creating some item templates for in VS 2010, any new pages created from these templates need to have a using statement for my mainClasses folder. The problem is that every time a new page is created VS changes the using statement from using MyProject.mainClasses to MyProject.LocationOfPage.mainClasses. It is obviously looking for the project name so it can change the namespace accordingly but annoyingly its also changing my using statement, which breaks my project.

I think this would't be a problem if I had a website project and an App_Code folder as I wouldn't need a using statement but it's not and I can't so I'm stuck :(

Any help greatfully appreciated if anyone can figure out what I'm bumbling on about.

I'm using C# by the way and the templates technique from the book(ish)

Cheers

Russ

Last edited by goose; August 5th, 2013 at 11:52 AM..
 
Old August 5th, 2013, 01:35 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I am not sure I understand the problem. VS usually doesn't change the using statement; are you maybe referring to the namespace element instead? Or did you include a dynamic placeholder in the template for the using statement?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 6th, 2013, 05:22 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

Thanks for the reply. I got to the bottom of it in the end. It was due to VS inserting placeholders in the using statement during export, so I had to go in to the zip files to manually remove them.

If it's any use I had:

using ProjMyproject.mainClasses;

Which VS was replacing with:

using $rootnamespace$.mainClasses;

This was causing it to change my using statement every time I created a new page using the templates.

Thanks again

Russ
 
Old August 6th, 2013, 06:56 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, yes, that makes sense. It picked that up from the project settings. For class names / namespaces that's what you want but VS didn't see this was a using statement.

Glad you were able to fix it.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!




Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help creating a ~300-item web survey RushNP774 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 March 26th, 2009 11:51 AM
Problem with creating ASP .NET web app/service reye VS.NET 2002/2003 1 December 28th, 2006 06:10 AM
Creating web custom controls problem Lerik ASP.NET 1.0 and 1.1 Professional 0 January 6th, 2006 06:39 AM
Creating Web Custom Controls Lerik C# 2005 0 January 6th, 2006 04:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.