Prev | Current Page 567 | Next

Rob Cameron and Dale Michalk

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

Ch10
{
[ToolboxData("<{0}:CustomerList runat=server>")]
public class CustomerList : CompositeControl
{
private const string strSelectCmd = @"Select * from [Customers]";
private const string strUpdateCmd = @"UPDATE [Customers] SET " +
@"[CompanyName] = @CompanyName, [ContactName] = @ContactName, " +
@"[Phone] = @Phone WHERE [CustomerID] = @CustomerID";
CHAPTER 10 ?–  OTHER S ERVER C ONTROLS 445
public CustomerList()
{
}
public String CustomerID
{
get
{
object customerID = ViewState["CustomerID"];
if (customerID == null)
return String.Empty;
else
return (String)customerID;
}
set
{
ViewState["CustomerID"] = value;
}
}
// Allow page developers to set the connection string.
public String ConnectionString
{
get
{
object connectionString = ViewState["ConnectionString"];
if (connectionString == null)
return String.Empty;
else
return (String)connectionString;
}
set
{
ViewState["ConnectionString"] = value;
}
}
public Boolean AllowCustomerEditing
{
get
{
object allowEditing = ViewState["AllowCustomerEditing"];
if (allowEditing == null)
return false;
else
return (Boolean)allowEditing;
}
446 CHAPTER 10 ?–  OTHER SERVER CONTROLS
set
{
ViewState["AllowCustomerEditing"] = value;
}
}
protected override void CreateChildControls()
{
Controls.


Pages:
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579