Generic Question about Codebehind forms

J

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?
 
G

Guest

so you want to do something like this

root director
|-----first virtual director
|-----first.aspx (first.aspx.cs
|-----second virtual director
|-----second.aspx(first.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
 
B

Bruno Sirianni

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>
 
B

Bruno Sirianni

Why separate assembly in GAC? If it is in bin directory there isn't problem!

Brun

one said:
so you want to do something like this:

root directory
|-----first virtual directory
|-----first.aspx (first.aspx.cs)
|-----second virtual directory
|-----second.aspx(first.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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top