What is the difference between inline coding & code behind.

Showing Answers 1 - 9 of 9 Answers

Debuajm

  • Jun 30th, 2006
 

Coding in the Aspx page file using

<%@ Page Language="vb" Strict="True" %>

is inline code. you need code behind page to do the code. and coding in the .aspx.cs page is code behind

  Was this answer useful?  Yes

rspsuba

  • Jul 8th, 2006
 

Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page. ie (.cs or .vb file) . regardsrajikiran

  Was this answer useful?  Yes

  inline-HTML page coding<% page languge="c#" codebehind=".name....aspx.cs" AutoEventwireup="false" inherits="......."%>.

codebehind--we are using .aspx(.vb or .cs). mean languge coding side

karthik.d 

<%@ Page language="c#" Codebehind="vp.aspx.cs" AutoEventWireup="false" Inherits="ClassicCarBase_Com.vp" %><%@ Page language="c#" Codebehind="vp.aspx.cs" AutoEventWireup="false" Inherits="ClassicCarBase_Com.vp" %><%@ Page language="c#" Codebehind="vp.aspx.cs" AutoEventWireup="false" Inherits="ClassicCarBase_Com.vp" %><%@ Page language="c#" Codebehind="vp.aspx.cs" AutoEventWireup="false" Inherits="ClassicCarBase_Com.vp" %><%@ Page language="c#" Codebehind="vp.aspx.cs" AutoEventWireup="false" Inherits="ClassicCarBase_Com.vp" %><%@ Page language="c#" Codebehind="vp.aspx.cs" AutoEventWireup="false" Inherits="ClassicCarBase_Com.vp" %>

  Was this answer useful?  Yes

Manish Srivastava

  • Feb 20th, 2007
 

When we write inline code we write code in the same page with Html code between scripting tags. So Each time when there is a request for page it compiles the code each time then server the page Like classic asp because inline code can not create Dll.
Where as in Code behiend file code write in seprate file from html file that is after compilation convert into dll which is muchfaster.

  Was this answer useful?  Yes

This option is asked when you are

Add New Item - > Web Form - > Place Code In seperatefile

Codebehind
The code behind programming model adds another file to the webpage
that is called codebehind page . the codebehind page consist server side code
thus seperating serverside code from clientsidecode and markup. (e.g
XYZ.aspx.vb)

Sample ::
Default.aspx.vb
Partial Class _Default


Inherits
System.Web.UI.Page

Protected Sub
Page_Load(ByVal sender As
Object, ByVal e As
System.EventArgs) Handles Me.Load
End Sub


End Class


Default.aspx

<%@ Page Language="VB"
AutoEventWireup="flase"
CodeFile="Default.aspx.vb" Inherits="_Default"
%>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">



<head
runat="server">
<title>Untitled
Page</
title>


</head>

<body
>
    <form

id="form1"
runat="server">
        <div>

        </div>

   
</
form>

</body>

</html>



InlineCode::
Example: Default.aspx
<%@ Page Language="VB"

AutoEventWireup="flase"
CodeFile="Default.aspx.vb"

Inherits="_Default" %>
<!
DOCTYPE

html
PUBLIC
"-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script
runat="server">
   
Protected
Sub Page_Load(ByVal
sender
As
Object
, ByVal e

As System.EventArgs)
   
End Sub
</
script>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
   
<
title>Untitled Page</title>

</head
>
<body>
   
<form

id="form1"
runat="server">
   
<div>

    </div>
   
</form>

</body>
</html>

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions