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
Rating: 5 stars5 stars5 stars5 stars5 stars / 5
January 30, 2008
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

A downloadable .rar file is available for this article.

News Management

This part of functionality is accomplished through the "NewsManage.aspx" page. Its total functionalities can be listed as follows:

  1. Show the news in a table form.
  2. Provide links to add a piece of news. 
  3. Provide links to edit a piece of news. 
  4. Delete news. 
  5. 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.

Next comes the notification-related topic.

Notification Management


Notification Management

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.

Leaving Words Management


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:

protected void Page_Load(object sender,EventArgs e){

if(!Page.IsPostBack)

{ ///bind data to the control

BindLeavewordData();

}

}

private void BindLeavewordData(){

///define the class that gets the data

Leaveword word = new Leaveword();

SqlDataReader dr = word.GetLeavewords();

///Set the control's data source

LeavewordView.DataSource = dr;

///bind data to the control

LeavewordView.DataBind();

///Close the database connection

dr.Close();

}

Deleting Left Words

Deleting the Left Words

When clicking the "X" button on the grid control the associated row will be deleted, as is shown through the listed code below:

protected void LeavewordView_RowCommand(object sender,GridViewCommandEventArgs e){

if(e.CommandName == "delete") {

///delete data

Leaveword word = new Leaveword();

word.DeleteLeaveword(Int32.Parse(e.CommandArgument.ToString()));

///rebind data to the control

BindLeavewordData();

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.

blog comments powered by Disqus
ASP.NET ARTICLES

- Implementing ASP.NET 4.0 Page.MetaDescriptio...
- ASP.Net Development Tips
- Intro to Sessions in ASP.Net
- Google Maps API Introduction in ASP.NET usin...
- Creating an ASP.NET 3.5 Gridview Image Galle...
- Encrypt QueryString in ASP.NET 3.5 using VB....
- ASP.NET 3.5 Drop Down List Controls
- Connect to Access Database with ASP.Net
- Secure Audio Streaming with ASP.Net and Flash
- Dynamic Sitemap and Navigation in ASP.Net
- Implement Gzip and Deflate Compression in AS...
- Run ASP.Net in Ubuntu with Apache
- ASP.Net Mono Website Contact Forms
- ASP.Net URL Rewriting Methods
- Murach`s ASP.NET 4 Web Programming with C# 2...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials