|
 |
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|
 |

August 5th, 2013, 11:30 AM
|
Registered User
|
|
Join Date: Apr 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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..
|

August 5th, 2013, 01:35 PM
|
 |
Wrox Author
Points: 72,055, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
|
|
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
|

August 6th, 2013, 05:22 AM
|
Registered User
|
|
Join Date: Apr 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

August 6th, 2013, 06:56 AM
|
 |
Wrox Author
Points: 72,055, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
|
|
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
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |
All times are GMT -4. The time now is 05:19 PM.
|