Prev | Current Page 419 | Next

Rob Cameron and Dale Michalk

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

ProviderName %>"
SelectCommand="SELECT [FirstName], [LastName], [Title] FROM [Employees]">





Listing 7-7. The DataboundRepeater Code-Behind Class File
using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Collections;
using System.Web.Configuration;
namespace ControlsBook2Web.Ch07
{
CHAPTER 7 ?–  SERVER CONTROL DATA B INDING 317
public partial class DataBoundRepeater : System.Web.UI.Page
{
protected System.Data.SqlClient.SqlDataAdapter dataAdapterEmp;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected DataSetEmp dataSetEmp;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string[] array = new String[] { "one", "two", "three" };
repeaterA.DataSource = array;
repeaterA.DataBind();
ArrayList list = new ArrayList();
list.Add("four");
list.Add("five");
list.Add("six");
repeaterAl.DataSource = list;
repeaterAl.DataBind();
SqlDataReader dr = GetCustomerDataReader();
repeaterRdrCust.DataSource = dr;
repeaterRdrCust.DataBind();
dr.


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