473,586 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

@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 7173
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="MyCl assName" %>
<html>
<body>
Hello <asp:Label id="lblName" runat="server"> </asp:Label>
<script runat="server">
void Page_Load(objec t 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
descriptio n for ClassName is:

Specifies the class name for the page that will be dynamically compiled
automaticall y 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="MyCl assName" %>
<html>
<body>
Hello <asp:Label id="lblName" runat="server"> </asp:Label>
<script runat="server">
void Page_Load(objec t 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
descriptio n for ClassName is:

Specifies the class name for the page that will be dynamically compiled
automaticall y 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
1914
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 use className, but when I uncheck a row I am having difficulty restoring the original (when the page loaded) className, I need to do this because the...
1
2895
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 files. I have no problem using my .vb code behind file for my .aspx pages i just have to say <%@ Page Language="vb" Inherits="myCode"...
1
3495
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 the .aspx with the html. As my start-point, i am building a login page. I put the textbox and submit button on the page index.aspx; and, i put all...
0
1328
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 MyMainClass : Page public class MyClass2 : MyMainClass
3
2264
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 file named ASPDS.dll Can anyone advise on how to interpret this?
1
6850
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 and page loading/rendering lifecycle.... Ok, now for the question: I have an ASPX page (page.aspx), and I have a UserControl (control.ascx). The...
4
230
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 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...
2
1666
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 a partial class and is more closely tied to the .aspx page. Is it possible to mimic this behavior in ASP.NET 2.0? The pros/cons of this approach...
1
1461
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 Public Class Constr : Inherits Page Public Sub New()
0
7912
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...
0
7839
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...
0
8338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8216
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...
0
6614
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...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1180
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...

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.