473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

@Page Attributes: ClassName vs. Inherits ??

Between ClassName and Inherits, which attribute is set to specify the class
that a page uses? I would think that would be inherits. Further, the
description for ClassName is:

Specifies the class name for the page that will be dynamically compiled
automatically when the page is requested. This value can be any valid class
name but should not include a namespace.

So this is what will decidw what gets compiled? Then what is the point of
the src attribute? Are these two attributes mutially exclusive?
Jul 21 '05 #1
4 7152
You can use ClassName to give a name to the page, when you use inline
code to define the page (using server-side script blocks).

If the server side code for the page is not defined inline, the source
can be specified in 2 ways:
- using the Inherits attribute - the code will be compiled into a DLL
before deployement. The Inherits attribute specifies which class
contains the code-behind for the given page.
- using the Src attribute - the code will be compiled dynamically at
runtime.

Joshua Flanagan
http://flimflan.com/blog

Ben R. wrote:
Between ClassName and Inherits, which attribute is set to specify the class
that a page uses? I would think that would be inherits. Further, the
description for ClassName is:

Specifies the class name for the page that will be dynamically compiled
automatically when the page is requested. This value can be any valid class
name but should not include a namespace.

So this is what will decidw what gets compiled? Then what is the point of
the src attribute? Are these two attributes mutially exclusive?

Jul 21 '05 #2
Hi Joshua,

Thanks for your response. Src and Inherits are much clearer. Could you give
me a scenario where you'd make use of the ClassName attribute? Would it be if
you were making a user control and wanted to be able to import the class it
generated?

-Ben

"Joshua Flanagan" wrote:
You can use ClassName to give a name to the page, when you use inline
code to define the page (using server-side script blocks).

If the server side code for the page is not defined inline, the source
can be specified in 2 ways:
- using the Inherits attribute - the code will be compiled into a DLL
before deployement. The Inherits attribute specifies which class
contains the code-behind for the given page.
- using the Src attribute - the code will be compiled dynamically at
runtime.

Joshua Flanagan
http://flimflan.com/blog

Ben R. wrote:
Between ClassName and Inherits, which attribute is set to specify the class
that a page uses? I would think that would be inherits. Further, the
description for ClassName is:

Specifies the class name for the page that will be dynamically compiled
automatically when the page is requested. This value can be any valid class
name but should not include a namespace.

So this is what will decidw what gets compiled? Then what is the point of
the src attribute? Are these two attributes mutially exclusive?

Jul 21 '05 #3
You use the ClassName whn you use inline code. It works for Pages and
user controls (which use the Control directive instead of Page).

Consider a file called MyPage.aspx that contained:

<%@ Page Language="C#" ClassName="MyClassName" %>
<html>
<body>
Hello <asp:Label id="lblName" runat="server"></asp:Label>
<script runat="server">
void Page_Load(object sender, EventArgs e){
lblName.Text = "Josh";
}
</script>
</body>
</html>
This page is completely self-contained. Notice that there is no
MyPage.aspx.cs file required. All of the HTML and server-side code is
included in the single page. Since there is no C# code file, you are
not explicitly defining a class. In order to give the page's class a
name, you use the ClassName attribute.

Ben R. wrote:
Hi Joshua,

Thanks for your response. Src and Inherits are much clearer. Could you give
me a scenario where you'd make use of the ClassName attribute? Would it be if
you were making a user control and wanted to be able to import the class it
generated?

-Ben

"Joshua Flanagan" wrote:

You can use ClassName to give a name to the page, when you use inline
code to define the page (using server-side script blocks).

If the server side code for the page is not defined inline, the source
can be specified in 2 ways:
- using the Inherits attribute - the code will be compiled into a DLL
before deployement. The Inherits attribute specifies which class
contains the code-behind for the given page.
- using the Src attribute - the code will be compiled dynamically at
runtime.

Joshua Flanagan
http://flimflan.com/blog

Ben R. wrote:
Between ClassName and Inherits, which attribute is set to specify the class
that a page uses? I would think that would be inherits. Further, the
description for ClassName is:

Specifies the class name for the page that will be dynamically compiled
automatically when the page is requested. This value can be any valid class
name but should not include a namespace.

So this is what will decidw what gets compiled? Then what is the point of
the src attribute? Are these two attributes mutially exclusive?

Jul 21 '05 #4
Thanks for the detailed response, Josh...

-Ben

"Joshua Flanagan" wrote:
You use the ClassName whn you use inline code. It works for Pages and
user controls (which use the Control directive instead of Page).

Consider a file called MyPage.aspx that contained:

<%@ Page Language="C#" ClassName="MyClassName" %>
<html>
<body>
Hello <asp:Label id="lblName" runat="server"></asp:Label>
<script runat="server">
void Page_Load(object sender, EventArgs e){
lblName.Text = "Josh";
}
</script>
</body>
</html>
This page is completely self-contained. Notice that there is no
MyPage.aspx.cs file required. All of the HTML and server-side code is
included in the single page. Since there is no C# code file, you are
not explicitly defining a class. In order to give the page's class a
name, you use the ClassName attribute.

Ben R. wrote:
Hi Joshua,

Thanks for your response. Src and Inherits are much clearer. Could you give
me a scenario where you'd make use of the ClassName attribute? Would it be if
you were making a user control and wanted to be able to import the class it
generated?

-Ben

"Joshua Flanagan" wrote:

You can use ClassName to give a name to the page, when you use inline
code to define the page (using server-side script blocks).

If the server side code for the page is not defined inline, the source
can be specified in 2 ways:
- using the Inherits attribute - the code will be compiled into a DLL
before deployement. The Inherits attribute specifies which class
contains the code-behind for the given page.
- using the Src attribute - the code will be compiled dynamically at
runtime.

Joshua Flanagan
http://flimflan.com/blog

Ben R. wrote:

Between ClassName and Inherits, which attribute is set to specify the class
that a page uses? I would think that would be inherits. Further, the
description for ClassName is:

Specifies the class name for the page that will be dynamically compiled
automatically when the page is requested. This value can be any valid class
name but should not include a namespace.

So this is what will decidw what gets compiled? Then what is the point of
the src attribute? Are these two attributes mutially exclusive?

Jul 21 '05 #5

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

Similar topics

2
by: bmgz | last post by:
I have written a script that highlights a table row when the appropriate checkbox is checked. Using element.style is a bit messy and doesn't really fulfil my needs.. I want to just be able to...
1
by: Michael Evanchik | last post by:
Tying not to spaghetti code which seems to be easy to do in .net, im trying to do my main .net html in index.aspx, use repeated .net html in an .ascx files and all code im doing in .vb code behind...
1
by: | last post by:
Hi guys! I am a beginner with aspx (i have some background with .asp). And i am trying tu use a 'code-behind' page in order to execute all transactions in that page and leave as clean as possible...
0
by: djus | last post by:
Hello At the begining I'm sorry for my English :( I want my aspx page TestPage.aspx to inherit from MyClass2. MyClass2 inherits from MyMainClass which is subtype of Page: public class...
3
by: | last post by:
Hi This could be easy for most of you, I come across with the following in one of the aspx files <%@ Page language="c#" Inherits="ASPDS.Admin" %> , and under the bin directory I found a dll...
1
by: Will Gillen | last post by:
I know this has probably been asked before, but I can't seem to find a solid answer in any of the archives. First, before my question, please forgive my limited knowledge of the event lifecycle...
4
by: Ben R. | last post by:
Between ClassName and Inherits, which attribute is set to specify the class that a page uses? I would think that would be inherits. Further, the description for ClassName is: Specifies the class...
2
by: Mark | last post by:
In ASP.NET 1.x a codebehind file X could inherit from class Y assuming that Y inherited from System.Web.UI.Page. In ASP.NET 2.0 this appears to be problematic since the previous codebehind is now...
1
by: Arpan | last post by:
What's the difference between "Imports" & "Inherits"? For e.g. both the codes below work without any errors: Imports System Imports System.Data Imports System.Web.UI Namespace Constructors...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
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...
0
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...
0
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,...
0
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...

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.