HomeASP.NET Information Management for an ASP.NET AJAX...
Information Management for an ASP.NET AJAX Server-Centric Based Online Shopping Website
In this tenth part of an eleven-part series on building your own online shopping website, we'll learn about the information center. The information center in the shopping city sample is mainly composed of three modules: news management, notification management, and leaving words management, which are all placed under the "admin/Information" folder of the website. Let’s delve into them, starting with the news management.
Contributed by Xianzhong Zhu Rating: / 5 January 30, 2008
This part of functionality is accomplished through the "NewsManage.aspx" page. Its total functionalities can be listed as follows:
Show the news in a table form.
Provide links to add a piece of news.
Provide links to edit a piece of news.
Delete news.
View news.
Let's take a look at the run-time snapshot of the "NewsManage.aspx" page, as is shown in Figure 35.
Figure 35-the run-time snapshot for managing news
As you can see from Figure 35, by clicking the "Title" hyperlinks the user can view the detailed news information, while by clicking "Edit" or "X" in the "operation" column he can edit (the "EditNews.aspx" page in Figure 36) or delete the related news.
Figure 36-the design-time snapshot for editing news
At last, when the user clicks the "Add new news" button in Figure 35 he will be navigated to another simple page, "AddNews.aspx," to add a new piece of news.
For now, we have ajaxified the news-related pages, partly due to these pages being simple and partly due to the time limit. For the details in this respect, please study the source code in the downloadable source code accompanying this article.
As you may have seen from the main page named "product.aspx," there is a bulletin board on the left of the page which mainly bears the responsibility of bringing the latest news about this shopping city to all the users. Note that only a piece of news will be displayed in the bulletin board. The following Figure 37 gives the design-time snapshot for the "Notice.aspx" page.
Figure 37-the design-time snapshot for publishing notification
It's pretty easy, isn't it? Here you can just attach a new piece of news and click the "OK" button, while clicking the "Return" button will lead you back to the "product.aspx" main page of the shopping city.
Next, I'll give you a short explanation of leaving words management.
First, let's look at the run-time snapshot for leaving words management (the "leavewordManage.aspx"), as is shown in Figure 38.
Figure 38-the running-time snapshot for leaving words management
It's still easy-merely a GridView control on the page with a few related links embedded in it to perform the viewing and deleting operation.
Initialization and Data Binding
When the "leavewordManage.aspx" page is initialized, the related left words information is bound to the "LeavewordView" GridView so that the words left by customers are displayed within the grid control, as is shown in the following code:
Response.Write("<script>alert('" + "Deleting successfully. Please safekeep your data!" + "');</script>");
}
}
Here we see a list of the typical GridView control operation. First find the "delete" command through the CommandName attributeof the GridViewCommandEventArgs parameter. Next, with the help of the member function named DeleteLeavewordof the Leaveword class,the selected left word is finally removed from the database. At last, refresh the grid control by invoking the BindLeavewordData help method. That's it.