Post by Goborijung at 2019-09-30 12:54:37 | ID: 117
<asp:Button ID="Button1" runat="server" Text="This Buton" />
Post by Goborijung at 2019-09-30 13:38:09 | ID: 121
<div id="div1" runat="server">
Hello ASP.Net
</div>
div1.Style("font-size") = "22pt"
div1.Style("width") = "310pt"
div1.Style("color") = "white"
div1.Style("background-color") = "#FF4500"Post by Goborijung at 2019-09-30 12:55:40 | ID: 118
<asp:Label ID="Label1" runat="server" Width="135px"></asp:Label><br />
Post by Goborijung at 2018-12-24 11:50:02 | ID: 16
Source code: http://www.infopress.co.th/devbook/DevBookASP451.zip Website Microsoft: http://msdn.microsoft.com
Post by Goborijung at 2021-03-17 09:15:40 | ID: 711
>>> ASP.NET Tutorial https://www.tutorialspoint.com/asp.net/index.htm
Post by Goborijung at 2021-03-17 09:15:06 | ID: 1047
[ASP.NET Core MVC Workshop#01] เริ่มต้นสร้าง Project และทำความรู้จัก Bootstrap https://bit.ly/30QfGf8 [10 ขั้นตอน] สร้าง Web Application เชื่อมกับ SQL Server Database ด้วย ASP.NET Core MVC แบบ Code (Model) First http://bit.ly/3vvLB2x
Post by Goborijung at 2019-10-05 16:30:03 | ID: 146
<asp:RadioButtonList ID="rdoSystem" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" ForeColor="Black">
<asp:ListItem> MDS </asp:ListItem>
<asp:ListItem> PTS </asp:ListItem>
<asp:ListItem> GSS</asp:ListItem>
</asp:RadioButtonList>Post by Goborijung at 2019-09-30 14:12:31 | ID: 124
<asp:Button ID="cmdCookiesNoKeys" runat="server" Text="สร้าง Cookies แบบไม่มี Keys" />
<asp:Button ID="cmdCookiesWithKeys" runat="server" Text="สร้าง Cookies แบบมี Keys" />
<asp:Button ID="cmdReadCookies" runat="server" Text="อ่านค่า Cookies" />
'** Get cookies not key **'
Protected Sub cmdCookiesNoKeys_Click(sender As Object, e As EventArgs) Handles cmdCookiesNoKeys.Click
Dim ck As New HttpCookie("FullName")
ck.Value = "Thaivb"
ck.Expires = Now.AddMonths(1)
Response.Cookies.Add(ck)
Response.Write("เก็บข้อมูลลงใน cookie แบบไม่มี key แล้ว")
End Sub
'** Get cookies with key **'
Protected Sub cmdCookiesWithKeys_Click(sender As Object, e As EventArgs) Handles cmdCookiesWithKeys.Click
Dim ck As New HttpCookie("FullName")
ck.Values("FirstName") = "Thaivb"
ck.Values("LastName") = ".NET"
ck.Expires = Now.AddMonths(1)
Response.Cookies.Add(ck)
Response.Write("เก็บข้อมูลลงใน cookie แบบมี key แล้ว")
End Sub
'** Read cookies **'
Protected Sub cmdReadCookies_Click(sender As Object, e As EventArgs) Handles cmdReadCookies.Click
Dim ckName As String
Dim GetCK As HttpCookie = Request.Cookies("FullName")
If GetCK Is Nothing Then Exit Sub
If GetCK.HasKeys Then
Dim ckValues As New NameValueCollection(GetCK.Values)
For Each ckName In ckValues.AllKeys
Response.Write(ckName & " : " & GetCK.Item(ckName) & "<br>")
Next
Else
Response.Write(GetCK.Value)
End If
End SubPost by Goborijung at 2019-09-30 14:44:40 | ID: 125
>>> ตัวอย่างการกล่าวคำทักทายผู้เยี่ยมชม Page ด้วย Cookies
<asp:Label ID="lblHello" runat="server" Text="Label"></asp:Label>
<br /><br /><br />
<asp:Label ID="Label1" runat="server" Text="ชื่อ : "></asp:Label>
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:Button ID="cmdSave" runat="server" Text="บันทึก" />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ck As HttpCookie = Request.Cookies("Hello")
Dim str As String = ""
If ck Is Nothing Then
lblHello.Text = "สวัสดี คุณ : Guest"
Else
str = "สวัสดี คุณ : " & ck("Name")
str &= "<br>คุณเข้าเว็บครั้งล่าสุด : " & ck("LastVisited")
lblHello.Text = str
End If
End Sub
Protected Sub cmdSave_Click(sender As Object, e As EventArgs) Handles cmdSave.Click
Dim ck As HttpCookie = Request.Cookies("Hello")
If ck Is Nothing Then
ck = New HttpCookie("Hello")
End If
ck("Name") = txtName.Text
ck("LastVisited") = DateTime.Now.ToString()
ck.Expires = DateTime.Now.AddMonths(1)
Response.Cookies.Add(ck)
End SubPost by Goborijung at 2019-09-30 13:17:44 | ID: 120
>>> ตัวอย่าง Code Cookies ใน ASP.Net
<asp:Button ID="cmdAdd" runat="server" Text="Add" />
<asp:Button ID="cmdRead" runat="server" Text="Read" />
'** Add Cookie **'
Protected Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click
Dim ck As New HttpCookie("FullName")
ck.Value = "Thaivb"
ck.Expires = Now.AddMinutes(0.1) 'หมดอายุใน 6 วินาที
Response.Cookies.Add(ck)
Response.Write("เก็บข้อมูลง Cookies แล้ว !!!")
End Sub
'** Read Cookie **'
Protected Sub cmdRead_Click(sender As Object, e As EventArgs) Handles cmdRead.Click
Try
' ถ้า cookie ยังไม่หมดอายุ
Response.Write(Request.Cookies("FullName").Value)
Catch ex As Exception
' ถ้า cookie หมดอายุแล้ว
Response.Write("Cookis หมดอายุแล้ว !!!")
End Try
End Sub