473,396 Members | 2,089 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,396 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 7150
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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,...

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.