Hello!
I'm new to ASP.NET application but I have been using C# windows form for one
year.
I'm reading a book about Webbdevelopment .
Below is a small ASP.NET application.
I just wonder why is it not any class like it is in the window form like
this
public class Test : Forms
{
....
}
I thought that everything must be put within a class
I created a project using template ASP.NET Web Application
then a class was created like this.
public class WebForm1 : System.Web.UI.P age
{
....
}
Now to my question :
1.So is it possible to create a ASP.NET application without putting the code
within a class. Like my ASP.NET application example below.
2.If I want to put my ASP.NET application below within a class how would it
look like then?
3.What is the difference for my ASP.NET application below if I put the code
in a class or have it as it is now without any class.
<%@ Page Language="C#" %>
<HTML>
<HEAD>
<SCRIPT RUNAT="SERVER">
protected void btnMyButton_Cli ck(object Source, EventArgs e)
{
lblMyLabel.Text = "Some <bclicked </bon the button!";
}
</SCRIPT>
</HEAD>
<BODY>
<H3>A simple webbformexample </H3>
<FORM RUNAT=SERVER>
<asp:Button id=btnMyButton
runat="server"
Text="My button"
onclick="btnMyB utton_Click" />
<br>
<br>
<asp:Label id=lblMyLabel
runat=server />
</FORM>
</BODY>
</HTML>The form upper border 2 1260
Tony Johansson wrote:
Now to my question :
1.So is it possible to create a ASP.NET application without putting the code
within a class. Like my ASP.NET application example below.
Yes.. as you did
2.If I want to put my ASP.NET application below within a class how would it
look like then?
I am guessing you are talking about Code-behind model of creating
asp.net application. And Visual Studio.Net uses the code-behind model,
as you saw from your WebForm1 example
3.What is the difference for my ASP.NET application below if I put the code
in a class or have it as it is now without any class.
The difference would be, when is the code compiled.
In code-Behind model, you compile all the code as a DLL and put it in a
bin folder and deploy. In an in-line coding, like your example below,
the code is compiled only at the time of actualy request.
and some other differences would be, clean code-separation from HTML
and also, by going with code-behind model you can protect intellectual
property, by not leaving the actual code in the aspx page, as it is
done in the inline coding
THere could be several other differences, but please do a google search
for "inline coding vs codebehind". You would find tons of literature
>
<%@ Page Language="C#" %>
<HTML>
<HEAD>
<SCRIPT RUNAT="SERVER">
protected void btnMyButton_Cli ck(object Source, EventArgs e)
{
lblMyLabel.Text = "Some <bclicked </bon the button!";
}
</SCRIPT>
</HEAD>
<BODY>
<H3>A simple webbformexample </H3>
<FORM RUNAT=SERVER>
<asp:Button id=btnMyButton
runat="server"
Text="My button"
onclick="btnMyB utton_Click" />
<br>
<br>
<asp:Label id=lblMyLabel
runat=server />
</FORM>
</BODY>
</HTML>The form upper border
begin 666 p.gif
M1TE&.#EAU0`.`) $``/___P``_P`````*( R'Y! $`````+ ````#5``X```+_
MA(^IR^T/HYRTVHNAR+P?L7E B%P1&V: C!;9?UX:KA@WV;= QXK@^\7BFI`*JA
MPG@T'9 8&2#DM#BCLP55 8E-D>=S$UC)4,A?CI? )TYDP-LMB+K;BR77/0T_ZA
MUZ/N._YYY^4C>+#U53 @8E&:&9E8DMDB4% B;$^&BT!A@'QXD@ EP#UIIGYJ6DZ
M>G78!6"8B'@Q]MAX(EF;A"!K*X22 >QJZ"7?5]N?9V=8YZG#\)M<S Z(P(Q-HS
M$0LYZQB)MIO;JW L6L^SWMR$,FD<G# A6.;B6:O* Z/?]*V-#'>/N=L,M@=%G)
MUK: IY@5"^;N("E1O^X !\X4,@;Q6]22ZJJ:MVR)>:1DG 7>/G,>$YB.]&<EIH
M#!F5E>\:VK-8;^)%C$MF]3+A#=L^6@(%@A/)KB0H/>,:JM.#[^ >H:LJSH,V
M31I&2MCZ^=P8<F "^;")*5?D*%@.WL 63+FCV+-JVV"5[#NGT+-Z[<N73KVIU1
#```[
`
end
with 2.0 there is no real difference between inline and code behind, as all
compiling is done by the aspnet_compiler . the code behind is a partial
class, so its like an include with the form code.
its just a matter of taste.
-- bruce (sqlwork.com)
"Kumar Reddi" <ku********@gma il.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
Tony Johansson wrote:
>Now to my question : 1.So is it possible to create a ASP.NET application without putting the code within a class. Like my ASP.NET application example below.
Yes.. as you did
>2.If I want to put my ASP.NET application below within a class how would it look like then?
I am guessing you are talking about Code-behind model of creating
asp.net application. And Visual Studio.Net uses the code-behind model,
as you saw from your WebForm1 example
>3.What is the difference for my ASP.NET application below if I put the code in a class or have it as it is now without any class.
The difference would be, when is the code compiled.
In code-Behind model, you compile all the code as a DLL and put it in a
bin folder and deploy. In an in-line coding, like your example below,
the code is compiled only at the time of actualy request.
and some other differences would be, clean code-separation from HTML
and also, by going with code-behind model you can protect intellectual
property, by not leaving the actual code in the aspx page, as it is
done in the inline coding
THere could be several other differences, but please do a google search
for "inline coding vs codebehind". You would find tons of literature
>>
<%@ Page Language="C#" %>
<HTML> <HEAD> <SCRIPT RUNAT="SERVER"> protected void btnMyButton_Cli ck(object Source, EventArgs e) { lblMyLabel.Text = "Some <bclicked </bon the button!"; } </SCRIPT> </HEAD>
<BODY> <H3>A simple webbformexample </H3> <FORM RUNAT=SERVER> <asp:Button id=btnMyButton runat="server" Text="My button" onclick="btnMyB utton_Click" /> <br> <br> <asp:Label id=lblMyLabel runat=server /> </FORM> </BODY> </HTML>The form upper border
begin 666 p.gif M1TE&.#EAU0`.` )$``/___P``_P`````*( R'Y! $`````+ ````#5``X```+_ MA(^IR^T/HYRTVHNAR+P?L7E B%P1&V: C!;9?UX:KA@WV;= QXK@^\7BFI`*JA MPG@T'9 8&2#DM#BCLP55 8E-D>=S$UC)4,A?CI? )TYDP-LMB+K;BR77/0T_ZA MUZ/N._YYY^4C>+#U53 @8E&:&9E8DMDB4% B;$^&BT!A@'QXD@ EP#UIIGYJ6DZ M>G78!6"8B'@ Q]MAX(EF;A"!K*X22 >QJZ"7?5]N?9V=8YZG#\)M<S Z(P(Q-HS M$0LYZQB)MIO;J WL6L^SWMR$,FD<G #A6.;B6:O* Z/?]*V-#'>/N=L,M@=%G) MUK: IY@5"^;N("E1O^X !\X4,@;Q6]22ZJJ:MVR)>:1DG 7>/G,>$YB.]&<EIH M#!F5E>\:VK-8;^)%C$MF]3+A#=L^6@(%@A/)KB0H/>,:JM.#[^ >H:LJSH,V M31I&2MCZ^=P8< F"^;")*5?D*%@.W L63+FCV+-JVV"5[#NGT+-Z[<N73KVIU1 #```[ ` end
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Edilmar |
last post by:
Hi,
First of all, I'm new in Python...
I have worked with manu langs and IDEs, like Delphi, VB, JBuilder, Eclipse,
Borland C++, Perl, etc...
Then, today I think IDEs like Delphi have a excelent environment to develop
apps with little time. I saw many people talking about Python like a easy
lang to learn and to develop. But I have look...
|
by: sk |
last post by:
I have an applicaton in which I collect data for different parameters
for a set of devices. The data are entered into a single table, each
set of name, value pairs time-stamped and associated with a device.
The definition of the table is as follows:
CREATE TABLE devicedata
(
device_id int NOT NULL REFERENCES devices(id), -- id in the...
|
by: Michael B. |
last post by:
I was just thinking about this, specifically wondering if there's any
features that the C specification currently lacks, and which may be
included in some future standardization.
Of course, I speak only of features in the spirit of C; something like
object-orientation, though a nice feature, does not belong in C.
Something like being able...
|
by: TPJ |
last post by:
Help me please, because I really don't get it. I think it's some stupid
mistake I make, but I just can't find it. I have been thinking about it
for three days so far and I still haven't found any solution.
My code can be downloaded from here:
http://www.tprimke.net/konto/PyObject-problem.tar.bz2. There are some
scripts for GNU/Linux system...
|
by: Steve |
last post by:
I have read a couple articles online, read my Jesse Liberty book but I am
still confused as to just what the best practices are for using exceptions.
I keep changing how I'm working with them and it has now, after 15k lines of
code resulted in a royal mess!
It's my hope to ask some specific questions with scenario examples and that
some of...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
| |
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |