Two aspx files that use one codebehind file. Is that possible?

Hi,

I try to deploy my new webproject. Unfortunately I allways get the aspnet_merge error duplicate types.
This error is based on my structure I think. There are two pages using one codebehindfile.
Is it possible to handle that?

Thanks in advance

Best regards
radi5


P.S. Thats my structure
-codebehind
 |
 |-App_data
 |  |
 |  |-CodeTest.aspx.vb
 |
 |-TestSeite1.aspx
 |-TestSeite2.aspx
 |-web.config

0
radi5
5/4/2006 7:23:59 AM
asp.net.vs-web-deploy-projects 789 articles. 0 followers. Follow

4 Replies
735 Views

Similar Articles

[PageSpeed] 37

Hi again,

is my question to stupid, to easy, to hard? Or is it just my bad english that prevents help?

Any reply is welcome ;-)

Best regards

radi5
0
radi5
5/8/2006 8:41:13 AM
Hi Forum,

I still have the same problem. Is there any help outside?

 <%@ Page Language="VB" AutoEventWireup="false" Codefile="App_Data\CodeTest.aspx.vb" Inherits="CodeTest" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>TestSeite1</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label ID="TestLabel" runat="server"/> </div> </form> </body> </html>  
Partial Class CodeTest
    Inherits System.Web.UI.Page
    'dim TestLabel as System.Web.UI.WebControls.Label
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myTest As New TestClass
        Me.TestLabel.Text = mytest.getText2Display
    End Sub
End Class
 
Thats my test case. May be that will help you to understand my problem. Background is the possibility to create several designs with one codebehind. That has to be possible somehow.

Best regards

radi5
0
radi5
6/22/2006 11:42:34 AM
Using .Net 1.1, I know it was possible to share a single code behind file against multiple aspx pages.  One of the developers I worked with insisted on doing this everywhere, and got to be quite a headache to debug, because changing one thing could break several on multiple pages.

I'm not sure if .Net 2.0 supports this, as I haven't tried, but I have a feeling it's not a best coding practice.  But since the whole process is OO, you could create an object that inherits off of the Page class, then have your two aspx files have their own code behind, but instead of the object inheriting the Page class, have it inherit your new class.  I did this in the 1.1 framework in VS 2002.  It worked perfectly fine in production, the only downfall was the Visual Studio didn't know how to display the page, and in the code it didn't auto complete.  I have taken a new route to how I approach this problem with 2.0 so I haven't run into those problems in VS 2005.

Hope that helps a little.
0
DSimmon
6/22/2006 2:08:39 PM
I allready tried to use inheritance for my problem, but the designer was not the only problem. The other point was definition of  controls in my master page. They are only acessable in my codebheind but not in my parent class. Nevertheless I will start redesigning my code and use a single codebehind file for each aspx file. Maybe its better to encapsulate the functions in an external dll and call these from the codebehind files.

Thanks for the advice in this direction.

radi5
0
radi5
6/22/2006 2:59:24 PM
Reply:

Similar Artilces:

How to use VB.Net Files in C# Project and Compile All project to Only One Assembly File.?
Hi all,I have a Library of Useful Functions and procedures But in VB.Net Language(*.vb not *.dll).All the time i have to Add additional Project to my current Project and add that VB.Net Library to it ,Then Compile it and Reference it to  my C# project and use it .so as a consequence,After Compilation in the "Bin" directory i have additional assembly Related to that VB.Net Class Library rather than one.I want to know is there any way to Achieve only One Assembly Not Two. Thanks In Advance.Regards.Nothing Is Quite Impossible !!!...

Can we deploy aspx files and individual codebehind files in the server without deploying the solution in .net 1.1?
Actually, as far as my knowledge, in .net 1.1 we just bulid the solution and deploy the aspx pages and the dll. Is it possible that we can deploy the codebehind and aspx pages instead of dll? Currently, i have deployed some aspx and codebehind vb files in the server, the pages are using some dlls which are to be put in GAC. But, the pages are working fine with the dlls in the bin folder but not removing from bin. That means it is unable to take the dll from GAC. Can any one help in this issue? Thanks , SonaliThanks,Sonali yes, In .net 1.1 also individual aspx pages work taking codebeh...

How do I import Two ASPX files into One aspx file.
Hello,I am trying to import two aspx files into one aspx file According to the picture. I have googled this and tried it with <%@ Import Namespace="header.aspx" %>  and <include file="header.aspx" path="[header.aspx='Open']" />.  No luck. I want one for the header of every page and one for the top of every page. This is like iframes but in VB aspx code not html.     I do not know if its possible to import aspx files. I am converting java into asp.net. I am also waiting for the book called ASp.Net Unleashed...

Web Deployment Project deploying files not included by Web Application Project
Recently my boss asked me to find a way to share a web site project between 2 separate projects which will only share a subset of the files in the folder.  I created 2 web applications projects in the folder and eliminated the web site project.  I discovered when I publish the web application projects, that it wasn't compiling the .as*x pages, so I looked into web deployment projects.  The problem I'm having with web deployment projects is that when I build them from the solution configuration, it copies all the files in the web project to the deployment folder and I c...

vb.net and c# files in one web application projects and website project
hi,I got a bunch of files which is the source code of the application I am working on, it did not have any solution or project files. They appear to be asp.net 2.0 files, as partial classes are used.I initially added these files to a website project and I was able to run app in VS2005. My problem starts when I try and deploy application. msbuild is used to compile dependent projects, but it does not generate a dll for my web project which contains an APP_CODE folder. So my web app files cannot find the dll it needs. Precompiling is not an option my our process. Does anyone has any suggestion...

Is it possible to use variables from .cs file into the designer file .aspx
Hi friends, I am new to ASP.NET. I have used ado.net classes in the codebehind file to get the data from database. Now i want to show the manipulated data  as per my requirements in the designer file (.aspx). Is it possible to use variable from .cs file into .aspx file. Thanks, madhumad          Hi, In the markup you place this: <asp:Literal runat="server" ID="ltlVariable" Text="<%# test %>" /> Create a property or a variable in your page like this: protected string test = "bl...

how do i link two different sitemap with the use of menu control in one .aspx file to two different hyperlink in the master page?
I have two menu control with similar file(eg.defect.aspx) in the master page, whenever i click the similar file(eg.defect.aspx) in either menu control, it will show both the menu control(eg.student menu and staff menu), but i only want to show only either one of the menu (eg,student menu only). Is there any solution to my problem? Am i able to use similar file(eg.defect.aspx) for two different sitemap and two menu control and only show one menu control. Hey, What should or should not be visible; the whole menu, or the selected field?  Are you h...

Web Deployment Project outputs too many files from Web Application Project
Hi everyone, I just downloaded and installed the final releases of the Web Deployment Project and Web Application Project. I created a simple Web Application Project, and then a Web Deployment Project for that web app. When I click Build on the Web Deployment Project context menu, the build succeeds, but in the target folder, I find more files than are necessary. Included are the vbproj, "My Project" folder, "obj" folder, and the files within those folders. This may be naive, but I was expecting the same results as right-clicking the Web App project and choosing Publish; just with the add...

How to deploy web project in VS 2005 using web setup project
I have developed a new .NET Web application in C#. It is working find in localhost, i want to deploy the application to the production server. Please let me know what are the steps i need to follow to create an MSI file with VS.NET Installer in VS 2005. When i am trying to create a websetup project with a new solution option, it is not giving me the primary output file selection, i mean to say i am not at all getting the list of resources to select in the drop down list and also my project in the projects drop down list. Please some boyd help me and tell me is there any thing need to be done...

Problem with two *.ascx-Files aiming one CodeBehind-*.cs -File
Hi there,i just got crazy because of Visual Studio 2005 and ASP .NET with C#...I used Code-Behind-Pages in my Project.I have a index.aspx which loads dynamically (decision by URL) different modules and either load dynamic.blackberry.ascx-Files or dynamic.browser.ascx (depends on the browser) into it:// File dynamic.blackberry.ascx <%@ Control Language="C#" AutoEventWireup="true" CodeFile="dynamic.cs" Inherits="blackberry_dynamic" %> // File dynamic.browser.ascx <%@ Control Language="C#" AutoEventWireup="true" CodeFil...

Web deployment project tries to compile files EXCLUDED from web application project
I am confused about the compiling process. I have a solution with 3 projects:a. class library projectb. web application projectc. web deployment projectThings were fine with this until I added a new .aspx file to the web app (item b above). I decided it wasn't ready for inclusion yet so I marked it with "Exclude from project". Now these 3 files get a different icon and are in fact excluded from the web app project (i.e. after this Exclude, I can Build the web app project without any errors).  BUT - if I try to run the app or I try to Build Solution or if I try to Build the...

VS.NET Whidbey on LH; No File/New/Project nor File/New/Solution
I've installed Longhorn, then VS.NET Whidbey (from the Whidbey DVD); then the MSDN Library for Whidbey; then the Longhorn SDK. When I open VS.NET the only File menu option I get for creating anything is New File ... A little lower on the File menu is New Web Site ... But no File/New/Project or Solution? Is there an install or configuration option I missed? As my understanding in alpha it is not there. But you can create a "new solution"!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti What profile did you apply when you installed? You may want to ...

could not open project and all .cs files, .aspx.cs files and .csproj file
All my projects could not open after one night. Error is like the following:The application for project 'http://localhost/WebApplication1/WebApplication1.csproj is not installed. Make sure the appliction for the project type(.csproj) is installedAnd when I check these files, all .cs files, .aspx.cs files and .csproj file's icon become notepad, could only open as a text file.Can I get any sugestion from here? Thanks a lot....

VS.net 2005 sln file and web project locations
Hi,Im working with visual studio.net 2005, and i was wondering why by default the .sln files and web project code are kept in seperate locations. Is there a particular reason and advantage for this?ThanksNM the .sln file is really irrelevant to the project. It's just a grouping file that's specific to your machine usually. If you want someone else to have the project they will likely need a modified sln file. Also, grouping the sln files in a different folder tree makes it so that you can have them all in one place. Web, Windows, Library, Console, etc... the sln are in one location t...

Web resources about - Two aspx files that use one codebehind file. Is that possible? - asp.net.vs-web-deploy-projects

ASP.NET - Wikipedia, the free encyclopedia
ASP.NET is a server-side Web application framework designed for Web development to produce dynamic Web pages . It was developed by Microsoft ...

C# dotnet SQL Editor (webform side)
Every time I need to develop a small business application I always try to choose the fastest and simplest way to implement it. This is why I ...

xClassNotDerivedFromElement – Another Non-Informative XAML Parse Error
... XAML is due to my lazyness. I Created a new xaml file but used the view template rather than a Resource Dictionary one, yes I deleted the codebehind ...

WPF Onyx
WPF Model-View-ViewModel framework.

Stronger Backbone - Part 2
... development, there was a framework called WebForms that developers would use to create web applications. WebForms used a system called "CodeBehind" ...

Use Custom Http Handlers To Improve Performance in ASP.NET
While reading a chapter from the upcoming book from Addison-Wesley entitled Essential ASP.NET with Examples in C# , I ran across a chapter on ...

Developing a Windows Phone Application using the MVVM Pattern
This documentation includes a companion sample application named PetrolTracker. PetrolTracker is an application written in Silverlight for Windows ...

Struggling for Competence
An event lets a publisher notify subscribers when something happens. The article examines event rules and convention, and presents a c# example. ...

CodeSOD: The Apex of T-SQL
... has all sorts of different ways to generate HTML. Rarely, it’s WebForms code living in as ASPX. Far more often, it’s hard-coded into the CodeBehind. ...

Happy Birthday, APRSdroid (my OSS Scala app for Android)!
APRSdroid is an Amateur Radio geo-location( APRS ) app for Android licensed under the GPL.It started as a Scala learning experience twoyears ...

Resources last updated: 12/3/2015 5:59:49 AM