|
-
Aug 5th, 2003, 09:15 AM
#1
Thread Starter
Fanatic Member
Copying a p[age in VS.net
I have a page in my web project "Webform.aspx" which has the general layout of all my pages and a blank code behind page
.
What I do is :
1) Copy the page and paste it into Visual Studio.
2) Rename it to......lets say "Webform1.aspx"
3) Change the code behing page so it reads
Public Class WebForm1
Whenever I try to run this new blank page I get the error :
Could not load type '_myProject.WebForm1'.
Can someone tell me how to do this. I am finding Visual Studio great for coding but at simple screen handling and general maintenance It is hopeless.
Thanks in Advance
-
Aug 5th, 2003, 12:24 PM
#2
In the top of the HTML side of your page, you'll have:
Code:
<%@ Page language="c#" Codebehind="pagename.aspx.cs" AutoEventWireup="false" Inherits="Namespace.pagename" %>
You have to make sure that the namespace & pagename parts match that of your new file's. So, if your original file came from:
Code:
<%@ Page language="c#" Codebehind="Webform.aspx.cs" AutoEventWireup="false" Inherits="MyProject.WebForm" %>
and you copy it to MyProject/Subfolder
Code:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="MyProject.Subfolder.WebForm1" %>
If I'm not mistaken 
[Edit]
And make sure that the namespace in your code behind file matches that of the HTML.
-
Aug 5th, 2003, 01:53 PM
#3
PowerPoster
Dude, you are doing way to much work. If you got a page template that other pages will be using, you should be using inheritance. Check out this link, it will help you out greatly.
http://www.codeproject.com/aspnet/page_templates.asp
Plus, if each page inherits from the base page, you can change just the base page, and all others get the changes automatically. It is awesome.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|