Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP.NET > ASP.NET HTML & Form > ASP.NET & HTML



Clound SSD Virtual Server

ASP.NET & HTML

ASP.NET & HTML ในภาษา ASP.NET สามารถแรก HTML ได้โดยตรงเหมือนกับภาษา PHP หรือ ASP ครับ ซึ่งผมจะแยกออกเป็น 2 ประเด็นคือ

Language Code : VB.NET || C#

1. เขียนในรูปแบบของ ASP Style

การเขียนในรูปแบบของ ASP Style คือการเขียนที่บรรจุดส่วนของ HTML และในส่วนของ ASP.NET Code ไว้ในไฟล์เดียวกัน ซึ่งสามารถพัฒนาได้บน Tool ทั่ว ๆ ไป เช่น Edit plus,Notepad,WebMatrx หรือ Macromedia Dreamweaver


MyFile.aspx (VB.NET)

<%@ Page Language="VB" %>
<%
Response.write ("This is ASP Tag")
%>
<script runat="server">
    Sub Page_Load()
        Me.txtName.Text = "This is ASP.NET Tag"
    End Sub
</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <%
        Response.write("This is ASP Tag<br>")
        %>
        <asp:Label id="lblText" runat="server" text="Text"></asp:Label>
        <asp:TextBox id="txtName" runat="server"></asp:TextBox>
    </form>
</body>
</html>


ASP.NET HTML



2. เขียนในรูปแบบของ Code-Behind Style

เป็นรูปแบบการเขียน Code ที่แยกในส่วนของ HTML และส่วนของ ASP.NET Code ไว้คนล่ะไฟล์ โดยส่วนของ HTML Form จะถูกจัดเก็บไว้ที่ .aspx และส่วนของ ASP.NET Code จัดเก็บไว้ที่ .asp.vb (VB.NET) หรือ .aspx.cs (C#) สำหรับ Tool ที่ใช้พัฒนาได้แก่โปรแกรม Visual Studio .NET 2003 และ Visual Studio 2005 หรือ Visual Studio 2008


ตัวอย่างการเขียนด้วย (VB.NET)

MyWebPage.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MyWebPage.aspx.vb" Inherits="MyWebPage" %>

<!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>
        <asp:Label ID="lblText" runat="server"></asp:Label>
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
	</div>
    </form>
</body>
</html>


MyWebPage.aspx.vb

Public Class MyWebPage
    Inherits System.Web.UI.Page

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

        Me.lblText.Text = "Name"
        Me.txtName.Text = "Mr.Weerachai Nukitram"

    End Sub
End Class


Screenshot

ASP.NET HTML


WebMatrix

Visual Studio .NET 2003

Visual Studio 2005,2008






   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2008-10-27 23:08:27 / 2009-06-02 16:38:37
  Download : No files
 Sponsored Links / Related

 
ASP.NET runat="server"
Rating :

 
ASP.NET Tag Form
Rating :

 
ASP.NET Web Control & HTML Control
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่