Prev | Current Page 439 | Next

Rob Cameron and Dale Michalk

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

FieldCount; ++i)
{
columnName = new TableCell();
headerRow.Cells.Add(columnName);
columnName.Text = temp.GetName(i);
}
}
if (dataRow is DataRowView)
{
DataRowView drv = (DataRowView)dataRow;
for (int i = 0; i < drv.Row.Table.Columns.Count; ++i)
{
columnName = new TableCell();
headerRow.Cells.Add(columnName);
columnName.Text = drv.Row.Table.Columns[i].Caption;
}
}
Listings 7-14 and 7-15 have the source code for EnhancedSpreadsheetControl and
EnhancedSpreadsheetRow respectively.
Listing 7-14. The EnhancedSpreadsheetControl Control
using System;
using System.Data;
using System.Drawing;
using System.ComponentModel;
using System.Collections;
using System.Data.Common;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ControlsBook2Lib.Ch07
{
[ToolboxData("<{0}:EnhancedSpreadsheetControl
runat=server>")]
public class EnhancedSpreadsheetControl : CompositeDataBoundControl
{
CHAPTER 7 ?–  SERVER CONTROL DATA B INDING 337
protected Table table = new Table();
[Browsable(false)]
public virtual TableRowCollection Rows
{
get
{
EnsureChildControls();
return table.Rows;
}
}
public Color HeaderRowBackColor
{
get
{
object headerRowBackColor = ViewState["HeaderRowBackColor"];
if (headerRowBackColor == null)
return Color.


Pages:
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451