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,038

HOME > ASP.NET > ASP.NET Collections > ASP.NET SortedList & Session


ASP.NET SortedList & Session

ASP.NET SortedList & Session เป็นตัวอย่างการใช้งาน Session กับ SortedList ซึ่งผมได้สร้างตัวแปร Object ของ SortedList และใช้ Session จัดเก็บตัวแปรดังกล่าว เพื่อนำไปใช้ยัง ณ ที่อื่น ๆ

Framework : 1,2,3,4

Language Code : VB.NET || C#

Syntax

Session("Name") = objSortedList()


AspNetSortedListSession1.aspx

01.<%@ Page Language="VB" %>
02.<script runat="server">
03.    Sub Page_Load(sender As Object, e As EventArgs)
04.        Dim objSortedList As SortedList
05.        Dim i As Integer
06.        Dim lsItem As String
07. 
08.        objSortedList = New SortedList
09. 
10.        objSortedList.Add("white", "#FFFFFF")
11.        objSortedList.Add("black", "#000000")
12.        objSortedList.Add("red", "#FF0000")
13.        objSortedList.Add("yellow", "#FFFF00")
14.        objSortedList.Add("green", "#00FF00")
15. 
16.        Session("mySession") = objSortedList
17. 
18.        Me.lblText.Text = "SortedList Created <a href=AspNetSortedListSession2.aspx>click here</a> to view"
19. 
20.    End Sub
21.</script>
22.<html>
23.<head>
24.<title>ThaiCreate.Com ASP.NET - SortedList</title>
25.</head>
26.<body>
27.    <form id="form1" runat="server">
28.        <asp:Label id="lblText" runat="server"></asp:Label>
29.    <br />
30.    </form>
31.</body>
32.</html>



AspNetSortedListSession2.aspx

01.<%@ Page Language="VB" %>
02.<script runat="server">
03.    Sub Page_Load(sender As Object, e As EventArgs)
04.        Dim objSortedList As SortedList
05.        Dim i As Integer
06.        Dim lsItem As String
07. 
08.        objSortedList = Ctype(Session("mySession"),SortedList)
09. 
10.        For Each lsItem In objSortedList.Keys
11.        Me.lblText.Text = Me.lblText.Text & "Key = " & lsItem & " , Value = " & objSortedList.Item(lsItem) &"<br>"
12.        Next
13. 
14.    End Sub
15.</script>
16.<html>
17.<head>
18.<title>ThaiCreate.Com ASP.NET - SortedList</title>
19.</head>
20.<body>
21.    <form id="form1" runat="server">
22.    <asp:Label id="lblText" runat="server"></asp:Label>
23.    <br />
24.    </form>
25.</body>
26.</html>


Screenshot

ASP.NET SortedList

ASP.NET SortedList

   
Hate it
Don't like it
It's ok
Like it
Love it
Share

Property & Method (Others Related)

ASP.NET SortedList
ASP.NET SortedList.Add()
ASP.NET SortedList.Remove()
ASP.NET SortedList.RemoveAt()
ASP.NET SortedList.Clear()
ASP.NET SortedList.GetByIndex()
ASP.NET SortedList.Count()
ASP.NET SortedList.Contains()
ASP.NET SortedList.ContainsKey()
ASP.NET SortedList.ContainsValue()
ASP.NET SortedList.Keys()
ASP.NET SortedList.Item()
ASP.NET SortedList & GetValue
ASP.NET SortedList.GetKey()
ASP.NET SortedList.GetKeyList()
ASP.NET SortedList.IndexOfValue()
ASP.NET SortedList.IndexOfKey()
ASP.NET SortedList.Clone()

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


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


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2008-11-23 08:56:19 / 2009-07-26 09:17:26
  Download : Download  ASP.NET SortedList & Session
 Sponsored Links / Related

 
ASP.NET Array
Rating :

 
ASP.NET ArrayList
Rating :

 
ASP.NET Hashtable
Rating :

 
ASP.NET SortedList
Rating :

 
ASP.NET Dictionary/StringDictionary
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
   





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