T
Tony Johansson
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.Page
{
....
}
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_Click(object Source, EventArgs e)
{
lblMyLabel.Text = "Some <b> clicked </b> on the button!";
}
</SCRIPT>
</HEAD>
<BODY>
<H3>A simple webbformexample</H3>
<FORM RUNAT=SERVER>
<asp:Button id=btnMyButton
runat="server"
Text="My button"
onclick="btnMyButton_Click" />
<br>
<br>
<asp:Label id=lblMyLabel
runat=server />
</FORM>
</BODY>
</HTML>The form upper border
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.Page
{
....
}
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_Click(object Source, EventArgs e)
{
lblMyLabel.Text = "Some <b> clicked </b> on the button!";
}
</SCRIPT>
</HEAD>
<BODY>
<H3>A simple webbformexample</H3>
<FORM RUNAT=SERVER>
<asp:Button id=btnMyButton
runat="server"
Text="My button"
onclick="btnMyButton_Click" />
<br>
<br>
<asp:Label id=lblMyLabel
runat=server />
</FORM>
</BODY>
</HTML>The form upper border