|
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CL.DataBinding;
namespace WebApplication1
{
/// <summary>
/// Summary description for _default.
/// </summary>
public class _default : System.Web.UI.Page
{
protected CL.DataBinding.PersonAdapter personAdapter1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Web.UI.WebControls.Label lblStatsHeader;
protected System.Web.UI.WebControls.TextBox FirstName;
protected System.Web.UI.WebControls.TextBox LastName;
protected System.Web.UI.WebControls.CheckBox CheckBox1;
protected System.Web.UI.WebControls.TextBox Textbox1;
protected System.Web.UI.WebControls.DropDownList FavoriteColor;
private System.ComponentModel.IContainer components;
private void Page_Load(object sender, System.EventArgs e)
{
//we need a person object to be created to get the
//ball rolling
if (StateHelper.Person==null)
StateHelper.Person=StateHelper.TestPerson;
//if the page has been posted back then apply updates requested
if (this.IsPostBack)
{
//pass form's Request name value collection to the
//static Update method
Person.Update(Request.Form);
}
//pass our person object to our adapter. The various controls
//are bound to this adapter
this.personAdapter1.Person=StateHelper.Person;
//this one line of code takes care of setting up the
//entire web form including setting controls' text properties
//back color etc etc
this.DataBind();
//the databinding should have taken care of this but
//for some reason it ignores the SelectedValue binding
//Oh well - we just do it ourselves then
this.FavoriteColor.SelectedValue =StateHelper.Person.FavoriteColor.Color;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.personAdapter1 = new CL.DataBinding.PersonAdapter(this.components);
//
// personAdapter1
//
this.personAdapter1.Person = null;
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Chris Lennon lives in Auckland, New Zealand. He is married with two children. He is a software development manager, currently working on a distributed Windows Forms.NET application written in C#.
He is a fan of Extreme Programming (XP) and Rapid Application Development (RAD) methedologies. His interest is in creating a template-driven approach to facilitate the production of high quality windows and web applications, within a short development cycle.
Besides looking after his kids, Chris attends Christian Life Centre Auckland, a vibrant church in the heart of Auckland City.