Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 375—Web App Dev II ASP.NET 8 More Binding. 2 The Repeater ControlThe Repeater Control 1 The Repeater control is used to display a repeated list of.

Similar presentations


Presentation on theme: "CIS 375—Web App Dev II ASP.NET 8 More Binding. 2 The Repeater ControlThe Repeater Control 1 The Repeater control is used to display a repeated list of."— Presentation transcript:

1 CIS 375—Web App Dev II ASP.NET 8 More Binding

2 2 The Repeater ControlThe Repeater Control 1 The Repeater control is used to display a repeated list of items that are bound to the control. The Repeater control may be bound to a database table, an XML file, or another list of items. We will use cdcatalog.xml in our examples.cdcatalog.xml Empire Burlesque Bob Dylan USA Columbia 10.90 1985

3 3 The Repeater Control 2 The code starts out by importing the ____________, using a DataSet object, associating it with the XML file, and binding when the page first loads: sub Page_Load if Not Page.IsPostBack then dim mycdcatalog = New DataSet mycdcatalog.ReadXml(MapPath("cdcatalog.xml")) cdcatalog.DataSource = mycdcatalog cdcatalog.DataBind() end if end sub

4 4 The Repeater Control 3 Then we create a Repeater control in an.aspx page. The contents of the element are rendered first and only once within the output. Then the contents of the element are repeated for each “________" in the DataSet Last, the contents of the element are rendered once within the output.

5 5 The Repeater Control 4--ExampleExample Title Artist Country Company Price Year

6 6 Alternating and Separating You can add an element following the element to describe the ___________ of alternating rows. (Ex.)Ex … The element can be used to describe a separator between each record. (Ex.)Ex

7 7 The DataList Control The DataList control, like the Repeater control, is used to display a repeated list of items that are bound to the control. However, the DataList control adds a _______ around the data items by default. Instead of We have DataList Example

8 8 Using Styles Creating styles for a DataList: <asp:DataList id="cdcatalog" runat="server" cellpadding="2" backcolor="#e8e8e8" width="100%" headerstyle-font-name="Verdana" headerstyle-font-size="12pt" headerstyle-horizontalalign="center" itemstyle-backcolor="#778899" alternatingitemstyle-backcolor="#e8e8e8" footerstyle-font-size="9pt" footerstyle-font-italic="true"> Styles Example AlternatingItem Style Example


Download ppt "CIS 375—Web App Dev II ASP.NET 8 More Binding. 2 The Repeater ControlThe Repeater Control 1 The Repeater control is used to display a repeated list of."

Similar presentations


Ads by Google