Back-end Management Tasks for an ASP.NET AJAX Server-Centric Based Online Shopping Website
(Page 1 of 6 )
This is the eighth part of an eleven-part series on building an online shopping web site. In this part, we will continue to look into the backside management tasks associated with product and order adding, modifying, and deleting, as well as managing comments on the products.
A
downloadable .rar file is available for this article.
Product Category Management
This part is done through the "Category.aspx" page. The following outlines the functionalities it will accomplish:
Show the product category info in control TreeView.
Provide the hyperlinks to add a new product category.
Provide the hyperlinks to modify the product categories.
Delete the specified product category.
Move the selected category upward.
Move the selected category downward.
The Interface Design
The following Figure 27 shows the design-time snapshot for product category management.
Figure 27—the design-time snapshot for product category management
/Building_ASP.NET_AJAX_Server-Centric_Shopping_Website(8)_html_62ec8cfb.png)
As you can see from the above figure, this will involve some typical tree control operations: adding, modifying, deleting, and moving the tree nodes.
Initialization
When the "category.aspx" page is first initialized, it should be able to display the present product categories in the TreeView control. And at the same time it should check whether or not the five Button controls in the page are enabled. Finally, it should attach a confirm dialog to the "Delete" button.
protected void Page_Load(object sender,EventArgs e){
if(!Page.IsPostBack){
BindCategoryData();
}
///set the availability of the button
AddBtn.Enabled = UpBtn.Enabled = DownBtn.Enabled = EditBtn.Enabled =
DeleteBtn.Enabled
= CategoryView.SelectedNode == null ? false : true;
///add the dialog that confirms the user to make the deletion
DeleteBtn.Attributes.Add("onclick","return confirm('Are you sure to delete
the selected items?');");
}
private void BindCategoryData(){
Category category = new Category();
category.BindCategoryTreeView(CategoryView,true,"-1");
}
Again, there are already enough comments provided here. The core work is done using the BindCategoryData helper function,which in turn invokes one of the important methods—BindCategoryTreeViewof the Category class. However, still for brevity, we do not delve into this method; you can refer to the "Category.cs" file under the App_Code folder that accompanies the downloadable source code (it provides a series of typical ASP.NET TreeView control operations).
Next: Moving Tree Nodes >>
More ASP.NET Articles
More By Xianzhong Zhu