Build your professional network on facebook via our app Go to app
 
<< Prev  10 of 20 in Topic  Next >>
Topic : ASP / ASP.NET Programming
  Rate : 
 
Industry : IT Services
Functional Area : Programming Languages
Activity: Question posted: 07 28 2008 05:21:23 +0000, 1 answers, 1474 views, last activity 07 06 2010 20:18:08 +0000
 
 Refer 16
Share
 
 
 
 
 Top Answer :
Rating : +1 

The type of coding style used by ASP developers is known as inline coding, inline code or in-page code because that was the only way to develop an ASP page. In ASP Pages scripting code working for generating desired output was intermixed with HTML code to create user friendly pages as well as specific functionality was added to the web pages. In those days inline code was very popular in VB developers because they had hands on experience in writing long vb scripts to create well defined huge asp web sites. But often, the combined intermixed HTML, JavaScript and VB Scripts become ambiguous for maintaining the readability of large web pages. You can design and code ASP .Net web pages using inline code but it becomes difficult to maintain the server side events of all the server controls on a single page.

Add Inline Code to ASP .Net Page and learn how to get current date and time using VB or C# script.

 

Code-Behind Approach

The New ASP .Net Framework has provided the way out to maintain the code for large web pages. Now you can design the HTML code page with .aspx extension separately and maintain the code files for the same .aspx page of VB and C# separately. This style of coding to develop web pages is called Code-Behind. Code Behind approach is a better way to develop and design the .aspx page having basic layout of a web page containing all the necessary controls required for the GUI of the web page. Then include the VB or C# code behind class file for handling the events of controls. This mechanism separates the web page from design layout from the coding part.

Code-Behind Example:

ASPX Page with design layout

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<html>
<head>
    <title>Code-Behind Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtname" runat="server"></asp:TextBox>
        <asp:Button ID="btnSubmit" runat="server" Text="Submit" /><br />
        <asp:Label ID="lblname" runat="server"></asp:Label></div>
    </form>
</body>
</html>


Code-Behind File

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        lblname.Text = txtname.Text
    End Sub
End Class



[ Delete ]
[ Edit ]
Report Abuse
by   Bhargavtripathi , Student, Global Tech Pvt Ltd  | 04 15 2009 12:44:22 +0000
 
 
Viewers also viewed
PHP vs ASP.NET
 
0 referals 10 arguments, 2738 views
AS BOTH VLSI EMBEDDED ARE CHIP DESIGN LEVEL PROGRAMMING WHICH ONE IS BETTER? MEANS WHICH HAVING...
 
1 referals 9 arguments, 5168 views
There are more disadvantages vs advantages
 
114 referals 5 arguments, 137 views
more...  
Unanswered Questions (65)
To brief on myself, I am P2P, PMP, MBA(IT), B.E.(CS), Oracle SCWCD, J2EE Professional with 8+...
 
0 referals 0 answers, 0 views
Helo rohit, i am Hemant from Kanpur UP,going to take admission in mca for 212 batch at cgc...
 
1 referals 0 answers, 0 views
hi tis s amarnath frm andhra university,am doin proj related to genetic algorithm.can u plz help...
 
1 referals 0 answers, 0 views
More From Author
Of Course. Why Not. But Person should be aggressive curious towards leaning new technology.
Nice one. Thanks for this.
Nice one. Thanks for this.
more...