web 2.0

ASP.NET(vb.net) & Code-Behind Style

ASP.NET(vb.net) & Code-Behind Model Microsoft recommends dealing with dynamic program code by using the code-behind model, which places this code in a separate file or in a specially designated script tag. Code-behind files typically have names like MyPage.aspx.cs or MyPage.aspx.vb while the page file is MyPage.aspx (same filename as the page file (ASPX), but with the final extension denoting the page language).

ShotDev Focus:
- ASP.NET & Code-Behind Model

Example

CodeBehind.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="CodeBehind.aspx.vb" Inherits="CodeBehind" %>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label id="lblText" runat="server"></asp:Label>
</form>
</body>
</html>

CodeBehind.aspx.vb

Public Class CodeBehind
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.lblText.Text = "ASP.NET Code Behind Style"
End Sub

End Class

Screenshot

ASP.NET & Code-Behind Model
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

One Response to “ASP.NET(vb.net) & Code-Behind Style”

  1. 1already…

Leave a Reply

You must be logged in to post a comment.