[RESOLVED]How to choose both name and masterpage for a new web form?

 Hi I am making a solution in Visual Studio which is going to include 3 projects, a website app, a winform app and a web service. But my question is about the dialog box I am presented for when I want to add a new Content Page to my Masterpage.

One option I have is to right click the Masterpage and select "Add Content Page", but doing this I am not allowed to choose the name of the new content page and it just gets an autogenerated name like Webform1.aspx.

The other option I have is to right click on the Project and choose "Add New Item" Here I can then choose to add a new Web Form, for which I myself can decide the name, but I am not allowed to choose a Masterpage for the new Web Form.

When I add new Web Forms to my project I would like to both be able to choose the name of the Web Form and to choose the Masterpage of the Web Form. How do I make Visual Studio open such a window for me?

I have some screen shots about the two options I am currently presented for, but I don’t know how to put them into this post, is it possible?

Regards Rune

When you do Add New Item, and select Web Form, there’s a checkbox towards the bottom of the dialog box labeled: "Select Master Page".  Select it and you’ll be able to pick a master page when after you click Add.

Hello MetalAsp

Well when I select "Add New Item" in a webform project with a Masterpage, my problem is  there is NOT a checkbox towards the bottom of the dialog box labeled: "Select Master Page".

I know what you are talking about, because previously I used Visual Web Developer Express 2008 and always when I added a new Web Form to a project with a Masterpage, I got exactly the dialog box you are talking about, but that’s just not happening to me
now when I use Visual StudioCry

I have made some screen shots where you can see the dialog box I am presented for, further you can see what kind of project I am working on and what it contains.

I don’t know how to show you the screen shots? Can it be done on the messages in this forum? Can I send them to you in an email?

Regards Rune

 

Maybe you’re using a Web Application and not a Website project.  If that’s the case, then when you select Add New Item, you’ll see a "Web Content Form" option, chose that and when you click Add, you’ll be presented with a different box to
select the master page.

Hi MetalAsp.Net

Yes you are right. I was working on a WebApplication and not a WebSite (I didn’t realize there was a differenceEmbarassed I
am a newbie).

Anyway when I opened a WebSite I got the dialog you are talking about so that I can choose both name of .aspx file and Masterpage.

I have marked your aswer as the answer, is there anything else I shall do?

Thank you! Quite useful information I think!

Well I properly ask other questions soon on my stumbling way out in the ASP.NET world.

Rune 

Glad you got it firgured out.  Thanks for making my answer.  I think there’s place where you mark the thread as closed or resolved or something like that.  I think that’s all you need to do.

Good luck in your continued .Net adventures… 

Leave a Reply