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 Repeater Control > ASP.NET Repeater Control



Clound SSD Virtual Server

ASP.NET Repeater Control

ASP.NET Repeater Control คอนโทรล Repeater ใช้สำหรับแสดงข้อมูลในรูปแบบของ Loop เช่น ข้อมูลจาก DataReader,DataSet หรือ DataTable


ASP.NET Repeater Control


ASP.NET Repeater Control

Framework : 1,2,3,4

Syntax

<asp:Repeater ID="[Name]" runat="server"></asp:Repeater>


Template

<HeaderTemplate>
// ส่วนหัว
</HeaderTemplate>

<AlternatingItemTemplate>
// สลับระหว่าง Rows
</AlternatingItemTemplate>

<ItemTemplate>
// ส่วนของการแสดงผลโหมดปกติ
</ItemTemplate>

<FooterTemplate>
// ส่วนล่างของการแสดงผล
</FooterTemplate>

<SeparatorTemplate>
// ส่วนของการแยกข้อมูลระหว่าง Rows
</SeparatorTemplate>




Event

Event เป็นตัวควบคุมเหตุการณ์ต่าง ๆ ของ Repeater ซึ่งในบทเรียนนี้ผมได้ยกตัวอย่างการใช้ Event ต่าง ๆ หลายตัว และ Event ที่ใช้อยู่ประจำเช่น

- ItemCreated เมื่อ Repeater ทำการ Created หรือเสร็จสิ้น
- ItemDataBound เมื่อ Repeater มีการ Bound ข้อมูลในแต่ล่ะ Rows
- ItemCommand เมื่อ Repeater มีการคลิกทำคำสั่งต่าง ๆ




Handles

การกำหนด Event Handles สามารถกำหนดได้ 2 รูปแบบครับ คือกำหนดในส่วนของ Tag Repeater หรือ กำหนดในส่วนของ Event Handles ของ Sub หรือ Function

1. กำหนดในส่วนของ Tag Repeater

<asp:Repeater id="myRepeater" runat="server" OnDataBound="myRepeater_DataBound"></asp:Repeater>

<script runat="server">
Sub myRepeater_DataBound(sender As Object, e As RepeaterItemEventArgs)

End Sub
</script>



2. กำหนดในส่วนของ Sub หรือ Function

<asp:Repeater id="myRepeater" runat="server></asp:Repeater>

Private Sub myRepeater_DataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs) Handles myRepeater.DataBound

End Sub


Declarative Syntax
<asp:Repeater
    DataMember="string"
    DataSource="string"
    DataSourceID="string"
    EnableTheming="True|False"
    EnableViewState="True|False"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnItemCommand="ItemCommand event handler"
    OnItemCreated="ItemCreated event handler"
    OnItemDataBound="ItemDataBound event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    runat="server"
    Visible="True|False"
>
        <AlternatingItemTemplate>
            <!-- child controls -->
        </AlternatingItemTemplate>
        <FooterTemplate>
            <!-- child controls -->
        </FooterTemplate>
        <HeaderTemplate>
            <!-- child controls -->
        </HeaderTemplate>
        <ItemTemplate>
            <!-- child controls -->
        </ItemTemplate>
        <SeparatorTemplate>
            <!-- child controls -->
        </SeparatorTemplate>
</asp:Repeater>


สำหรับการใช้งาน Repeater ในรูปแบบต่าง ๆ สามารถศึกษาได้จากหัวข้อถัดไปครับ






   
Share


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


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


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2008-11-05 18:39:41 / 2011-06-17 22:01:08
  Download : No files
 Sponsored Links / Related

 
ASP.NET Repeater Control - DataBind
Rating :

 
ASP.NET Repeater Control - Alternate Rows
Rating :

 
ASP.NET Repeater Control - Separator Rows
Rating :

 
ASP.NET Repeater Control - DataBound
Rating :

 
ASP.NET Repeater Control - DataSet,DataTable,TableRows
Rating :

 
ASP.NET Repeater Control - XML
Rating :

 
ASP.NET Repeater Control - AccessDataSource
Rating :

 
ASP.NET Repeater Control - FindControl
Rating :

 
ASP.NET Repeater Control - VS .NET 2003 (FX 1.1)
Rating :

 
ASP.NET Repeater Control - VS 2005,2008,2010 (FX 2.0,3.5,4.0)
Rating :

 
ASP.NET Repeater Control - Microsoft Access (.mdb) - System.Data.OleDb
Rating :

 
ASP.NET Repeater Control - SQL Server 2000,2005,2008 - System.Data.SqlClient
Rating :

 
ASP.NET Repeater Control - MySQL Database - MySql.Data.MySqlClient
Rating :

 
ASP.NET Repeater Control - Oracle Database - System.Data.OracleClient
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 02
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 อัตราราคา คลิกที่นี่