.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

what is inline and code behind?

Posted By: RASHMI KUSHWAHA     Posted Date: August 01, 2011    Points:5   Category :C#
what is inline and code behind? please explain.. help me..


Responses
Author: Sasi Prabhu             
Posted Date: August 01, 2011     Points: 20   

In inline approach, the server-side code is written along with the html in the .aspx page itself. while in code-behind approach, the server-side code is written in a separate .aspx.cs code file and referenced by the .aspx page.

Thanks & Regards,
Sasi Prabhu.
Author: Sasi Prabhu             
Posted Date: August 01, 2011     Points: 20   

Hi,Generally the terms in-line code and code behind are the 2 approaches in which we can code our applications. In our Windows based applications the designing and Programming are both implemented in the same page whereas in an web-application we have the option of either going with the code behind or an in-line code in ASP.Net. In-ine code is generally can be done by adding our code in the HTML page of our ASP.Net application. Code behind can be done in our cs file of our application. Here the Designing is different from the Coding.

Thanks & Regards,
Sasi Prabhu.
Author: Sasi Prabhu             
Posted Date: August 01, 2011     Points: 20   

Code-Inline model in Asp.Net
In Code-Inline model the code & event handlers for the controls are located in <script> blocks in the same .aspx file that contains the HTML and controls. Code-Inline model is useful when you want to maintain your code and presentation logic in a single file.

Code-behind model in Asp.Net
ASP.NET also supports another way to factor your code and presentation content, called the code-behind model. When using code-behind, the code for handling events is located in a physically separate file from the page that contains server controls and markup. This clear delineation between code and content is useful when you need to maintain these separately, such as when more than one person is involved in creating the application. It is often common in group projects to have designers working on the UI portions of an application while developers work on the behavior or code. The code-behind model is well-suited to that environment.


Thanks & Regards,
Sasi Prabhu.
Author: RAJ             
Posted Date: August 01, 2011     Points: 20   

Inline code:
------------
The presentation logic and business logic is placed with in the same page is called
inline code.the business logic embeded with in <script> tags.

Code behind:
-------------
The presentation logic and business logic are separated with two file that is called code behind.
like presentation logic means .aspx file and business logic means .cs file

Regards
--------
Raju
Author: Gowthammanju             
Posted Date: August 02, 2011     Points: 20   

Using this syntax, you can use inline code in ASP.NET (.aspx) pages. The server-side code will be automatically compiled by the .NET framework the first time the page is requested on the server. The compiled .dll file is stored in the "Temporary ASP.NET Files" system folder. Changing the code in .aspx files will trigger a new compilation, generating new .dll files. The old .dll files are phased out by the framework and eventually deleted.


here it is as

<%@ Import Namespace="System" %>
<%@ Page Language="c#"%>

<script runat="server">
public string ServerSideFunction(string input)
{
return "Hello " + input;
}
</script>

<% string pageVariable = "world"; %>
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>ASP.NET inline</title>
</head>
<body>
<% =ServerSideFunction(pageVariable) %>
</body>
</html>


Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Gowthammanju             
Posted Date: August 02, 2011     Points: 20   

try these example as


http://asp-net-example.blogspot.com/2008/10/aspnet-inline-coding-model-example.html

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: oswaldlily             
Posted Date: August 02, 2011     Points: 20   

inline code is " if u write ur gridview_rowdatabound/gv_rowupdating/gv_rowdatabound etc code in same page of design" then is inline code

if u write this in code behind then u ll know




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend