Hi All,
I have created a vb file that inherits a System.Web.UI.P age. As I am
against duplicating source code, I have set the Codebehind attribute on all
my aspx pages in the same directory. This works a treat.
Now, I have a sub-directory full of aspx pages that I wish to point to this
wonderful vb file using the Codebehind attribute again. The designer errors
with "The class file '../basepage.vb' specified as the codebehind for
'default.aspx' could not be loaded. Make sure that the codebehind attribute
in the page or control directive properly references an existing code behind
file."
Ok, so the designer does not work for these pages. If I then debug the web
application and visit one of this pages in the sub-directory, it fires the
Page_Load event and runs my code and all is fine.
So, my question is how do I get the designer to work for these pages in the
sub-directory?
Landers 2 2545
I'd suggest not using this strategy as you'll be swimming upstream
against the tools, esepcially when it comes time to move to 2.0.
A better approach would be to put all of your common code into a base
class derived from System.Web.UI.P age, and then derive all your web
form pages from this custom base class. You'll be able to resuse your
code and still have tool support and flexibility to make changes.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Fri, 9 Sep 2005 22:49:19 +0100, "landers"
<la************ ****@hotmail.co m> wrote: Hi All,
I have created a vb file that inherits a System.Web.UI.P age. As I am against duplicating source code, I have set the Codebehind attribute on all my aspx pages in the same directory. This works a treat.
Now, I have a sub-directory full of aspx pages that I wish to point to this wonderful vb file using the Codebehind attribute again. The designer errors with "The class file '../basepage.vb' specified as the codebehind for 'default.asp x' could not be loaded. Make sure that the codebehind attribute in the page or control directive properly references an existing code behind file."
Ok, so the designer does not work for these pages. If I then debug the web application and visit one of this pages in the sub-directory, it fires the Page_Load event and runs my code and all is fine.
So, my question is how do I get the designer to work for these pages in the sub-directory?
Landers
Thanks for your response. I have got it working now.
When I first tried I got the following error when trying to view the page in
a designer:
<<Error Message>>
The file could not be loaded into the Web Foms designer. Please correct the
following error and then try loading it again:
Type Abstract
Make sure all of the classes used in the page are built or references in the
project.
<<End Error Message>>
It turns out that you cannot use MustInherit on the base class. Also, you
must declare the base class as Public, as Friend just does not work.
Thanks again.
"Scott Allen" <sc***@nospam.o detocode.com> wrote in message
news:ft******** *************** *********@4ax.c om... I'd suggest not using this strategy as you'll be swimming upstream against the tools, esepcially when it comes time to move to 2.0.
A better approach would be to put all of your common code into a base class derived from System.Web.UI.P age, and then derive all your web form pages from this custom base class. You'll be able to resuse your code and still have tool support and flexibility to make changes.
-- Scott http://www.OdeToCode.com/blogs/scott/
On Fri, 9 Sep 2005 22:49:19 +0100, "landers" <la************ ****@hotmail.co m> wrote:
Hi All,
I have created a vb file that inherits a System.Web.UI.P age. As I am against duplicating source code, I have set the Codebehind attribute on all my aspx pages in the same directory. This works a treat.
Now, I have a sub-directory full of aspx pages that I wish to point to this wonderful vb file using the Codebehind attribute again. The designer errors with "The class file '../basepage.vb' specified as the codebehind for 'default.aspx ' could not be loaded. Make sure that the codebehind attribute in the page or control directive properly references an existing code behind file."
Ok, so the designer does not work for these pages. If I then debug the web application and visit one of this pages in the sub-directory, it fires the Page_Load event and runs my code and all is fine.
So, my question is how do I get the designer to work for these pages in the sub-directory?
Landers This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Krunom Ancini |
last post by:
Hi,
im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind (without
dll.-s in bin-folder)?
I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...
|
by: Graham Allwood |
last post by:
I'm reading the Essential ASP.NET book by Fritz onion and he says that when
VS.NET creates a new .aspx page for you is uses the codebehind attribute on
the Page directive rather than the src attribute. From what I understand the
src attrib is standard ASP.NET but the codebehind attribute is only
understood by VS.NET. Doesn't this make the pages (source code) less
portable? Is there any reason for this?
Hope someone can help.
|
by: Maurice Walmsley |
last post by:
hi, I hope someone can help me with this please
I'm trying to move my codebehind files to a folder other than the one
my webform sits in. I've tried changing the 'scr' page level attribute
of my webform, but i get the following parser error;
Parser Error Message: 'c:\WebForm2.aspx.vb' is a physical path.
this the code;
|
by: ani |
last post by:
When I try to open the web form page, I get a designer
error which says:
'the file could not be loaded into the web forms designer.
Please correct the following error and then try loading it
again:
The @Page or @Control directive contains a src=attribute,
which is not supported in Visual Studio.
|
by: A.M |
last post by:
Hi,
Using VS.NET 2003, If i use SRC page attribute instead of CodeBehind, do i
still have intelisence and generally IDE support for that?
Thanks,
Ali
| |
by: Wardeaux |
last post by:
All,
Wanting to find a way to create web pages to add to my website without
having to recompile the codebehind everytime I want to add a new one...
Here's the deal:
I have a web app that takes work orders for 7 different items, each item
gets 1 page for input specs. All works well. I want to add a new item. I
do not want to recompile and redistribute my app everytime just to add a new
input page. Can ASPX resources be compiled into a...
|
by: Jack |
last post by:
Hello,
What is the difference between SRC and CODEBEHIND Tags?
Example
<%@ Page Language="vb" ValidateRequest="false" AutoEventWireup="false"
Codebehind="WebForm1.aspx.vb" %>
or
|
by: Gürkan Demirci |
last post by:
Hi,
i am using the VisualStudio FormDesigner to create an asp:table.
I want to populate an asp:tablecell with different controls at runtime.
In the codebehind file, there is an attribute for the asp:table. I can use
this to
access the tablerow and tablecell objects. It would be more convenient to
access a tablecell through
a class-attribute. Why is VisualStudio not creating an attribute for
tablerow or tablecell ?
|
by: aling |
last post by:
I create ASP.Net 2 website project in VS 2005, but the solution file
always uses absolute path in PhysicalPath attribute. I want to copy
the website project anywhere, so the absoluted path not wanted. But
when I changed the PhysicalPath attribute in solution file, I can't
open it in VS 2005.
Anyone can tell me how to modify the PhysicalPath attribute in
solution file to use relative path?
Thanks.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |