ARTICLE

How to work with Inline Coding Model in ASP.NET using VB.NET

Posted by Dea Saddler Articles | ASP.NET using VB.NET April 26, 2011
In this article you will learn about Inline Coding Model.
Download Files:
 
Reader Level:

Introduction

In this article I am discussing inline coding model in. In inline coding model business logic appears in <script></script> block in the .aspx page itself. When first time the page loads it compiles into a class that resides in an assembly stored in a subfolder of "c:\windows\Microsoft.Net\FrameWork\v4.x.xxxx\temporaryasp.net files" folder. This compiled version of the page is good untill the .aspx file changes or the application is restarted. At that time it will have to be recompiled.


Getting started

  • Simply create a new ASP.NET web application. 
  • Drag two labels, one Textbox and a Button control on page. The page will look like below.

    Inline1.gif
     
  • Then attach the below code.

    <%@ Page Title="Home Page" Language="vb"  AutoEventWireup="false"
        CodeBehind="Default.aspx.vb" Inherits="ModeEncode._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 Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            Label1.Text = "Your Friend Name: " & TextBox1.Text.ToString()
        End
    Sub
    </script>
    <
    html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Asp.Net Inline Coding Model Example</title
    >
    </head>
    <
    body>
        <form id="form1" runat="server">
        <div>
            <asp:Label ID="Label1" runat="server" Font-Size="Larger" ForeColor="Crimson"></asp:Label>
            <br />
            <asp:Label ID="Label2" runat="server" Text="Friend Name" AssociatedControlID="TextBox1"></asp:Label>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <br />
            <asp:Button ID="Button1" runat="server" Text="Click Me" OnClick="Button1_Click" />
        </div>
        </form
    >
    </body>
    </
    html>
     
  • Now run your application.


Output:-

Inline2.gif

Inline3.gif

Inline4.gif

Summary

In this article you learned how you can build Inline Coding Model.

Login to add your contents and source code to this article
share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor