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

Home Posts Topics Members FAQ

Generic Question about Codebehind forms

jm
I have a question about codebehind. I have an upload namespace, class
and all in a codebehind. I currently have it so it works with one of
my .aspx pages. I want to use it for another .aspx page. The problem
is that they codebehind looks at a specific directory (since it was
only being used by one page). I need it to decide which directory to
go to based upon which page is using the codebehind page. Can I just
reference the private subs in my codebehind from my .aspx page and
send another parameter telling which page is calling and make a
decision. I know I could just copy and paste the page over, but that
defeats the purpose.

I guess the main question is about referencing subs in the codebehind
page. If I reference the page in my page directive, can't I call the
codebehind subs just like any other sub?
Nov 18 '05 #1
6 1641
one
so you want to do something like this

root director
|-----first virtual director
|-----first.aspx (first.aspx.cs
|-----second virtual director
|-----second.aspx(fir st.aspx.cs

If I haven't tried the above but I don't think it will work. However, I will put the function (sub) in a seperate assembly (dll) and place that in the GAC. Code-behind is not designed to be shared among pages

HT

----- jm wrote: ----

I have a question about codebehind. I have an upload namespace, clas
and all in a codebehind. I currently have it so it works with one o
my .aspx pages. I want to use it for another .aspx page. The proble
is that they codebehind looks at a specific directory (since it wa
only being used by one page). I need it to decide which directory t
go to based upon which page is using the codebehind page. Can I jus
reference the private subs in my codebehind from my .aspx page an
send another parameter telling which page is calling and make
decision. I know I could just copy and paste the page over, but tha
defeats the purpose

I guess the main question is about referencing subs in the codebehin
page. If I reference the page in my page directive, can't I call th
codebehind subs just like any other sub

Nov 18 '05 #2
one
so you want to do something like this

root director
|-----first virtual director
|-----first.aspx (first.aspx.cs
|-----second virtual director
|-----second.aspx(fir st.aspx.cs

If I haven't tried the above but I don't think it will work. However, I will put the function (sub) in a seperate assembly (dll) and place that in the GAC. Code-behind is not designed to be shared among pages

HT

----- jm wrote: ----

I have a question about codebehind. I have an upload namespace, clas
and all in a codebehind. I currently have it so it works with one o
my .aspx pages. I want to use it for another .aspx page. The proble
is that they codebehind looks at a specific directory (since it wa
only being used by one page). I need it to decide which directory t
go to based upon which page is using the codebehind page. Can I jus
reference the private subs in my codebehind from my .aspx page an
send another parameter telling which page is calling and make
decision. I know I could just copy and paste the page over, but tha
defeats the purpose

I guess the main question is about referencing subs in the codebehin
page. If I reference the page in my page directive, can't I call th
codebehind subs just like any other sub

Nov 18 '05 #3
Why you don't do a class with your code and then use this??

Example :
public class Job
{
public static void DoJob() {....};
}

In other you can try to make some function virtual and then override.
Brun.

NB :
You must remember that codebehind directive is used only by Visual Studio
(for tree I think!). Framework don't watch this!
..aspx page can derive from any class that derive from Page class.
"Src" directive is used by Framework for runtime compile c# or vb.net code.
"Inherits" for set class that .aspx must inherits.

This code work without problem :
<%@ Page language="c#" %>
<script runat=server>
public string GetPippo()
{
string s = null;
s = "<h3>pippo</h3>";
return s;
}
</script>
<form id="Form1" method="post" runat="server">
<% = GetPippo() %>
</form>
"jm" <jo************ *@yahoo.com> wrote in message
news:c6******** *************** ***@posting.goo gle.com...
I have a question about codebehind. I have an upload namespace, class
and all in a codebehind. I currently have it so it works with one of
my .aspx pages. I want to use it for another .aspx page. The problem
is that they codebehind looks at a specific directory (since it was
only being used by one page). I need it to decide which directory to
go to based upon which page is using the codebehind page. Can I just
reference the private subs in my codebehind from my .aspx page and
send another parameter telling which page is calling and make a
decision. I know I could just copy and paste the page over, but that
defeats the purpose.

I guess the main question is about referencing subs in the codebehind
page. If I reference the page in my page directive, can't I call the
codebehind subs just like any other sub?

Nov 18 '05 #4
Why you don't do a class with your code and then use this??

Example :
public class Job
{
public static void DoJob() {....};
}

In other you can try to make some function virtual and then override.
Brun.

NB :
You must remember that codebehind directive is used only by Visual Studio
(for tree I think!). Framework don't watch this!
..aspx page can derive from any class that derive from Page class.
"Src" directive is used by Framework for runtime compile c# or vb.net code.
"Inherits" for set class that .aspx must inherits.

This code work without problem :
<%@ Page language="c#" %>
<script runat=server>
public string GetPippo()
{
string s = null;
s = "<h3>pippo</h3>";
return s;
}
</script>
<form id="Form1" method="post" runat="server">
<% = GetPippo() %>
</form>
"jm" <jo************ *@yahoo.com> wrote in message
news:c6******** *************** ***@posting.goo gle.com...
I have a question about codebehind. I have an upload namespace, class
and all in a codebehind. I currently have it so it works with one of
my .aspx pages. I want to use it for another .aspx page. The problem
is that they codebehind looks at a specific directory (since it was
only being used by one page). I need it to decide which directory to
go to based upon which page is using the codebehind page. Can I just
reference the private subs in my codebehind from my .aspx page and
send another parameter telling which page is calling and make a
decision. I know I could just copy and paste the page over, but that
defeats the purpose.

I guess the main question is about referencing subs in the codebehind
page. If I reference the page in my page directive, can't I call the
codebehind subs just like any other sub?

Nov 18 '05 #5
Why separate assembly in GAC? If it is in bin directory there isn't problem!

Brun

"one" <on***********@ online.nospam> wrote in message
news:66******** *************** ***********@mic rosoft.com...
so you want to do something like this:

root directory
|-----first virtual directory
|-----first.aspx (first.aspx.cs)
|-----second virtual directory
|-----second.aspx(fir st.aspx.cs)

If I haven't tried the above but I don't think it will work. However, I will put the function (sub) in a seperate assembly (dll) and place that in
the GAC. Code-behind is not designed to be shared among pages.
HTH

----- jm wrote: -----

I have a question about codebehind. I have an upload namespace, class and all in a codebehind. I currently have it so it works with one of
my .aspx pages. I want to use it for another .aspx page. The problem is that they codebehind looks at a specific directory (since it was
only being used by one page). I need it to decide which directory to
go to based upon which page is using the codebehind page. Can I just
reference the private subs in my codebehind from my .aspx page and
send another parameter telling which page is calling and make a
decision. I know I could just copy and paste the page over, but that
defeats the purpose.

I guess the main question is about referencing subs in the codebehind
page. If I reference the page in my page directive, can't I call the
codebehind subs just like any other sub?

Nov 18 '05 #6
Why separate assembly in GAC? If it is in bin directory there isn't problem!

Brun

"one" <on***********@ online.nospam> wrote in message
news:66******** *************** ***********@mic rosoft.com...
so you want to do something like this:

root directory
|-----first virtual directory
|-----first.aspx (first.aspx.cs)
|-----second virtual directory
|-----second.aspx(fir st.aspx.cs)

If I haven't tried the above but I don't think it will work. However, I will put the function (sub) in a seperate assembly (dll) and place that in
the GAC. Code-behind is not designed to be shared among pages.
HTH

----- jm wrote: -----

I have a question about codebehind. I have an upload namespace, class and all in a codebehind. I currently have it so it works with one of
my .aspx pages. I want to use it for another .aspx page. The problem is that they codebehind looks at a specific directory (since it was
only being used by one page). I need it to decide which directory to
go to based upon which page is using the codebehind page. Can I just
reference the private subs in my codebehind from my .aspx page and
send another parameter telling which page is calling and make a
decision. I know I could just copy and paste the page over, but that
defeats the purpose.

I guess the main question is about referencing subs in the codebehind
page. If I reference the page in my page directive, can't I call the
codebehind subs just like any other sub?

Nov 18 '05 #7

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

Similar topics

2
2887
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.
1
1290
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.
12
1758
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
3
238
by: jm | last post by:
I have a question about codebehind. I have an upload namespace, class and all in a codebehind. I currently have it so it works with one of my .aspx pages. I want to use it for another .aspx page. The problem is that they codebehind looks at a specific directory (since it was only being used by one page). I need it to decide which directory to go to based upon which page is using the codebehind page. Can I just reference the private...
5
4372
by: Selden McCabe | last post by:
I have an application where they want to create numerous forms (for example, an expense reimbursement form, a book availability form, etc.). The idea is someone would create a form for a user to fill out, and after it's filled out, the user would click "submit" and the completed form (or at least the user-supplied information) would be emailed to someone. Of course, one approach is to just program each form in ASP.Net. But I was...
7
2222
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
3
1277
by: nagesh | last post by:
hi guys, when we compiling the asp.net project, all codebehind pages gives you one dll. suppose if i write the code in .aspx forms itself then is it create a dll ? if i write the code in aspx files then wht is going on when running the project?
3
6637
by: Harry Haller | last post by:
Hello, I want to implement a generic list which will be used to display 7 columns in a GridView. One should be able to sort, filter and page each of the 7 columns. Ideally the filter should be implemented simultaneously for multiple columns - but the data need only be sorted by a single column at a time. Sorting should be both ascending and descending. I'm currently using a DataView but it's far too slow, because there are a large...
7
10398
by: j4richard | last post by:
Help please, I am getting this "Unhandled Exception has occurred in your application" " A Generic error occurred in GDI+" See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
2
2472
by: Andrus | last post by:
Winforms UI assembly has static FormManager.FormCreator method which creates forms taking entity as parameter. I need to pass this method to business objects in business assembly so that business methods can also create forms but does not have reference to UI assembly. I tried code below but got compile errows shown in comments. How to fix ? Andrus.
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9572
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,...
1
10303
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
10070
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
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
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.