Prev | Current Page 416 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

NET
Repeater server control.
Data Binding with the Repeater Control
Our long journey to build a Repeater control replica is complete. Now, we need to take it for a
test drive with a variety of .NET collection types and a design-time DataSet to prove that the
core feature set works as advertised.
The Databound Repeater web form has five Repeater controls that are attached to five
different collection types: Array, ArrayList, SqlDataReader, DataSet, and an IDataSource-based
control. The form also has a button on it to exercise the postback capabilities of the Repeater
control to show how the control remembers its previous content without having to perform an
additional data bind. The UI for the web form is shown in Figure 7-6.
CHAPTER 7 ?–  SERVER CONTROL DATA B INDING 313
Figure 7-6. The rendered Databound Repeater web form
Listings 7-6 and 7-7 show the full code for the web form.
Listing 7-6. The DataboundRepeater Web Form .aspx File
<%@ Page Language="C#"
MasterPageFile="~/MasterPage/ControlsBook2MasterPage.Master"
AutoEventWireup="true" CodeBehind="DataBoundRepeater.aspx.cs"
Inherits="ControlsBook2Web.Ch07.DataBoundRepeater"
Title="DataBound Repeater Demo" %>
<%@ Register TagPrefix="apress" Namespace="ControlsBook2Lib.


Pages:
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428