Ch07.RepeaterCommandEventArgs rce)
{
ControlsBook2Lib.Ch07.RepeaterItem item = rce.Item;
Label lblID = (Label)item.FindControl("lblID");
status.Text = lblID.Text + " was clicked!";
}
protected void repeaterRdrCust_ItemDataBound(object o,
ControlsBook2Lib.Ch07.RepeaterItemEventArgs rie)
{
ControlsBook2Lib.Ch07.RepeaterItem item = rie.Item;
DbDataRecord row = (DbDataRecord)item.DataItem;
string ID = (string)row["CustomerID"];
Label lblID = (Label)item.FindControl("lblID");
lblID.Text = ID;
}
322 CHAPTER 7 ?– SE RVER CONTROL DATA B INDING
protected void repeaterRdrCust_ItemCreated(object o,
ControlsBook2Lib.Ch07.RepeaterItemEventArgs rie)
{
ControlsBook2Lib.Ch07.RepeaterItem item = rie.Item;
if (item.ItemType == ListItemType.Item)
{
Label lblID = new Label();
lblID.ID = "lblID";
item.Controls.Add(lblID);
item.Controls.Add(new LiteralControl(" "));
}
}
}
}
More work remains for the AdvancedDataRepeater after rendering??”specifically, firing
events. The web form is wired into the ItemCommand event raised by the Repeater control. This is
triggered by the ASP.NET Button control that is a part of each row rendered in conjunction with
the data from the Customers table in the Northwind database:
protected void repeaterRdrCust_ItemCommand(object o,
ControlsBook2Lib.
Pages:
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436