Comment and Order Management for an ASP.NET AJAX Server-Centric Based Online Shopping Website - Initialization
(Page 3 of 4 )
Initialization
When the "OrderManage.aspx" page is initialized, the related OrderFormdata is bound to GridView "OrderView," i.e. showing the factual order data and its associated state.
protected void Page_Load(object sender, EventArgs e){
Session["UserID"] = 1;
///bind data to the control
if(!Page.IsPostBack) {
BindOrderData();
}
}
private void BindOrderData(){
///define the class that gets the data
OrderForm order = new OrderForm();
SqlDataReader dr = order.GetOrderFormByUser(Int32.Parse(Session["UserID"].ToString()));
///Set the control's data source
OrderView.DataSource = dr;
///bind data to the control
OrderView.DataBind();
///Close the database connection
dr.Close();
}
Since there are enough comments on nearly each line of code here, let’s continue to see how to commit the order.
Next: Committing the Order >>
More ASP.NET Articles
More By Xianzhong Zhu