Comment and Order Management for an ASP.NET AJAX Server-Centric Based Online Shopping Website (Page 1 of 4 )
Welcome to the ninth part of an eleven-part series focused on building an online shopping web site. In this part you will learn to manage both product comments and orders.
A
downloadable .rar file is available for this article.
Product Comment Management
The product comment management functionality is accomplished through the "CommentManage.aspx." Its total functionalities can be listed as follows:
Show the comments in a table form.
Delete comments.
View comments.
Interface
First, let’s take a look at the design-time snapshot for product comment management, as displayed in Figure 33.
Figure 33—the design-time snapshot for product comment management
/Building_ASP.NET_AJAX_Server-Centric_Shopping_Website(9)_html_m45609e19.png)
As you can see from the above figure, only Ajax is leveraged. When the user clicks the "X" ImageButton in the GridView control to delete the selected comment, to give the user a very clear prompt asking whether or not to make the deletion, we use the ASP.NET AJAX Toolkit control namedConfirmButtonExtenderto pop up a dialog to gain this effect. Since the HTML code is very long, we’ll only look at the part directly related to what we're doing, as follows:
<asp:TemplateField HeaderText="Operation">
<ItemTemplate>
<asp:ImageButton id="deleteBtn" ImageUrl="~/images/delete.gif" AlternateText="Delete" runat="server"
CommandName="delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"CommentID") %>'/>
<ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="deleteBtn" ConfirmText="Are you sure to delete the selected items?">
</ajaxToolkit:ConfirmButtonExtender>
</ItemTemplate>
<ItemStyle Width="10%" BorderWidth="1px" HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
From the above code, you can easily find out how the ConfirmButtonExtendercontrol is attached to the‘X’ ImageButton. Note that one of the benefits to using most of the ASP.NET AJAX Toolkit controls is that they are very easy to follow up, with no programming required.
Since the coding behind is pretty easy to grasp and we still have a long way to travel we don’t plan to delve into this any more but leave this task to the sedulous readers.
Next: Order Management >>
More ASP.NET Articles
More By Xianzhong Zhu