Inline Coding Model in ASP.NET using VB.NET

In this article you will learn about Inline Coding Model.
  • 2831


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\ 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.

  • 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" "">
    <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
    html xmlns="">
    <head id="Head1" runat="server">
        <title>Asp.Net Inline Coding Model Example</title>
        <form id="form1" runat="server">
            <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" />
  • Now run your application.







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


More Articles

© 2020 DotNetHeaven. All rights reserved.