Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | 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 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 .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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..
Reply With Quote
  #2 (permalink)  
Old August 5th, 2013, 01:35 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
Old August 6th, 2013, 06:56 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:19 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.