Register Register Member Login Member Login Member Login Forgot Password ??
PHP Tutorial (Hypertext Preprocessor), ASP Tutorial (Active Server Pages), ASP.NET Tutorial (.Net 1.1,2.0,3.5)
   
   
  Registered : 70,501
   
 
HOME > ASP.NET > ASP.NET HTML & Form > ASP.NET Web Control & HTML Control
Search

ASP.NET Web Control & HTML Control

 
 
 
ASP.NET Web Control & HTML Control ในภาษา ASP.NET ตัว Web Control และ HTML Control หน้าตาบางตัวจะเหมือนกัน แต่ทำงานต่างกันสิ้นเชิงครับ เพราะ Web Control จะถูกทำงานและควบคุมได้จากฝั่ง Web Server สามารถกำหนด Properties หรือ Attribute ได้ แต่ในส่วนของ HTML Control จะทำงานที่ฝั่ง Client และทำการส่ง Request ให้กับ Web Server อีกทีครับ

Language Code : VB.NET || C#

Syntax

- Web Control
<asp:Control id="[Name]" runat="server"></asp:Control>
- HTML Control
<input id="Name" name="Name" type="text" />
<input id="Name" name="Name" type="radio" />
...



MyFile.aspx (VB.NET)

<%@ Page Language="VB" %>
<script runat="server">
	Sub Page_Load()
		Me.lblText1.Text = "Please input Name "
	End Sub

    Sub btnSubmit_OnClick(sender as Object, e As EventArgs)
        Me.lblName.Text = Me.txtName.Text
        Me.lblSurname.Text = Me.txtSurname.Text
        Me.lblFullName.Text = Request.Form("txtFullName")
    End Sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">
        <asp:Label id="lblText1" runat="server" text="Name"></asp:Label>
        <asp:TextBox id="txtName" runat="server"></asp:TextBox>
        <asp:Label id="lblText2" runat="server" text="Surname"></asp:Label>
        <asp:TextBox id="txtSurname" runat="server"></asp:TextBox>
        <br />
        <span><label>FULL</label></span>
        <input id="txtFullName" name="txtFullName" type="text" value="<%=Request.Form("txtFullName")%>" />
        <asp:Button id="btnSubmit" onclick="btnSubmit_OnClick" runat="server" Text="Submit"></asp:Button>
        <hr />
        <asp:Label id="lblName" runat="server"></asp:Label> <asp:Label id="lblSurname" runat="server"></asp:Label>
        <br />
        <asp:Label id="lblFullName" runat="server"></asp:Label>
    </form>
</body>
</html>



คำอธิบาย

จากตัวอย่างจะเห็นว่า Web Control ชื่อ lblText1 สามารถถูกควบคุมได้จากฝั่ง Web Server ซึ่งแตกต่างกับ HTML Control ที่สามารถทำการอ่านค่าได้จาก Request

Screenshot

ASP.NET HTML


ASP.NET HTML Controls

ASP.NET Web Controls




 

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

 
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rate :  
  Create/Update Date : 2008-11-03 10:43:10 / 2009-06-02 16:40:22
  View : 2,393
  Download : No files
   
 
Sponsored Links
 
 
Ads Contact : 08-1987-6107
Download Mozilla Firefox
 
Ads Contact : 08-1987-6107
 Sponsored Links
ASP.NET & HTML
Rate : View : 3,351
ASP.NET runat="server"
Rate : View : 2,562
ASP.NET Tag Form
Rate : View : 2,152
 
 
© www.ThaiCreate.Com. 2003-2009 All Rights Reserved. My network : ThaiGoodWeb.Com , DVDmono.com
Comments & Suggestions Please Contact Us : thaicreate at hotmail dot com [Conditions Privacy Statement] ติดต่อโฆษณา 01-987-6107 อัตราราคา คลิกที่นี่