473,804 Members | 3,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS Designer code change

Hello all,
When we add a new component in default.aspx in the designer mode, it
automitically adds a line declairing the component in the codebehind. We dont
want the declaration of this component in the code behind because we inherit
from a base class which already contain this declaration of the component.
For example, we need a "TopMenu" component in all pages so we declared it in
the Base Class. The base class will fill this menu...
My issue is that when I use the Design mode, VS adds the component
declarations in my code behind. So I have the declaration twice (code behind
& base class) and this two declaration makes conflict.
Do you have any idea to create a base class & use the design mode without
having this conflic?
Thanks.
Nov 19 '05 #1
1 1302
Hi Julien,

Welcome to ASPNET newsgroup.
From your description, you've define a base page class for your asp.net web
site and other pages will derive their codebehind page class from that base
one. Also, you've defined an component object reference as member in the
base class. However, when you add such a component in the derived page's
design-view, you found the VS.NET IDE will always add a new reference
member variable in the derived class rather than associate the component
with the reference in base class, yes?

As for this problem, I'm afraid it is due to the existing limitation on
ASP.NET Web form's page inheritance. The current ASP.NET web page's
inheritance is just simple codebehind class's inheritance on language
layer. It is not the actual Visutal inheritance like the winform's form
inheritance. So when we add new components or controls in ASP.NET page's
design-view in VS.NET IDE, the IDE has no idea of the existing component or
contorl reference in parent codebehind page class, it'll always add
reference member in the derived page class's code.

In ASP.NET 2.0, the MasterPage feature provide the complete Webform Visual
Inheritance that can help us add components or controls in MasterPage.

http://msdn.microsoft.com/library/de...us/dnvs05/html
/masterpages.asp

Thanks,
Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2259
by: dp | last post by:
After looking and looking, it appears that Access ADPs graphic query designer won't display: update customer set = . from customer, where customer. = .; It comes up with the "Query Definitions Differ" dialog box. Anybody know anything about this? I can live this with I guess, however it was sure
1
2591
by: Chuck Haeberle | last post by:
We have need to share functionality across all of our application web pages, so we decided to subclass from System.Web.UI.Page. When we create a new aspx, the Visual Studio designer automatically puts in the codebehind, as such: public class testsubclass : System.Web.UI.Page We change this to be: public class testsubclass : OurProject.Library.BaseWebPage Which is defined as:
1
1204
by: Carlo Marchesoni | last post by:
Some days ago I asked this forum whether it is possible to set up the <title> from the code-behind. A couple of poeple helped me and in fact it is quite ease: a) change the HTML, e.g.: <title id="titAV0010" runat="server"></title> b) define the field as GenericControl: protected System.Web.UI.HtmlControls.HtmlGenericControl titAV0010; c) change modifying the innerText property: titAV0010.InnerText = rm.GetString("AV0010.Title"); This...
0
1425
by: Ken Dopierala Jr. | last post by:
Hi, When I change properties through the property window on my custom control and then move focus from that property cell VS.Net runs the GetDesignTimeHtml() method on my designer. When I implement a UITypeEditor, change the values, then close the editor nothing happens until I switch the HTML view (which shows the changes) and then switch back to design view which then shows the new stuff. I can get to my component through the...
11
2275
by: PAul Maskens | last post by:
The form designer adds unnecessary code to the section when using a subclassed control. I've reproduced this in VS.NET 2002 and VS.NET 2003 so it's pretty fundamental. Outline steps: Create a VB project. Create a subclass of a UI control, I used TextBox. Add no code to the subclass. Public Class Component1
4
3161
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps further away, completely leaving the selector box area. Any ideas? VS 2003 and VB.Net This is a simple application at the moment but the form is inherited from a
6
6021
by: Nathan Sokalski | last post by:
I recently converted some ASP.NET 1.1 projects of mine, created with Visual Studio .NET 2003, to Web Application Projects in Visual Studio .NET 2005 so that I could use ASP.NET 2.0 (All my ASP.NET is done using VB.NET). After converting, everything was fine, and worked and compiled correctly, but I noticed one big difference between the VB.NET code of the converted files in the projects and the VB.NET code in new pages. The new pages use...
13
5260
by: cj | last post by:
In a project done in 2003 about a year ago I was told to add the SocketWrench code below into the Windows Form Designer generated code area as shown below. #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer.
4
2652
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. - Why is this happening? - Can I disable automatic declaration and have everything be declared manually? - Any other options to fix this? Thanks in advance. Goran Djuranovic
2
2432
by: Tony Johansson | last post by:
Hello! There is a file called Forms1.Designer.cs that is located below Form1.cs if we assume that we call the file that name. I wonder if it's allowed to change in the file Forms1.Designer.cs except InitializeComponent ? One more question is it really any point to change in the Forms1.Designer.cs ? I just wonder if it's enought in general to change only in the Form1.cs if we call the file that name ?
0
10561
Oralloy
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...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
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...
0
9132
agi2029
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...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
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();...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.