SunQuest
 
       ASP.NET
  Home arrow ASP.NET arrow Finishing an Online E-Mail System in ASP.N...
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Finishing an Online E-Mail System in ASP.NET 2.0
By: Xianzhong Zhu
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2007-06-13

    Table of Contents:
  • Finishing an Online E-Mail System in ASP.NET 2.0
  • Deleting Folders
  • Reading Your Email
  • Deleting Your Email
  • Moving Your Email

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Finishing an Online E-Mail System in ASP.NET 2.0


    (Page 1 of 5 )

    Yesterday we began designing the interface for an online e-mail system in ASP.NET 2.0. Today, in the conclusion to this four-part series, we pick up where we left off. As you'll recall, the last thing we did was learn how to create folders; in this article, we'll learn how to rename and delete folders, and read and move e-mail.
    A downloadable .rar file is available for this article.

    Renaming Folders

    In this sample, renaming the folder is achieved through the RenameFolder.aspx, page. Figure 10 shows the relevant design-time snapshot.

    Figure 10-the design-time view of the RenameFolder.aspx page

    Since there are few controls on the page and their functions can be easily doped out, we choose not to waste time on the controls but to dive right into the associated code.

     

    int nFolderID = -1;

    protected void Page_Load(object sender,EventArgs e)

    {

      ///get the value of parameter nFolderID

      if(Request.Params["FolderID"] != null)

      {

        if(Int32.TryParse(Request.Params["FolderID"].ToString(),out nFolderID) == false)

        {return;}

      }

      if(!Page.IsPostBack)

      { ///show name of the folder

        if(nFolderID > -1) { BindFolderData(nFolderID); }

      }

    }

    private void BindFolderData(int nFolderID)

    {

      IFolder folder = new Folder();

      SqlDataReader dr = folder.GetSingleFolder(nFolderID);

      if(dr.Read())

      {

        Name.Text = dr["Name"].ToString();

      }

      dr.Close();

    }

     

    Here, when the RenameFolder.aspx page is initialized, we first obtain the value of the nFolderID parameter out of the address bar (of the browser), then call a helper function named BindFolderData which bears the responsibility of grabbing the information of the folder out of the database using the nFolderID parameter, and then displays the folder name in the text box called Name. Next, when you click the OK button (with the id of RenameBtn), renaming is started:

     

    protected void NewBtn_Click(object sender,EventArgs e)

    {

      try

      { ///define the object

        IFolder folder = new Folder();

        ///execute

        folder.RenameFolder(nFolderID,Name.Text.Trim());

        Response.Write("<script>alert('" + "Renaming succeeded, safekeep you data!" + "');</script>");

      }

      catch(Exception ex)

      { ///jump to the page dealing with exception handling

        Response.Redirect("ErrorPage.aspx?ErrorMsg=" + ex.Message.Replace("<br>","").Replace("n","")

          + "&ErrorUrl=" + Request.Url.ToString().Replace("<br>","").Replace("n",""));

      }

    }

     

    Here, when you click the OK button, the NewBtn_Click event is triggered to call the helper function named RenameFolder to rename the folder and persist the new name into the database. Finally, clicking the Return button will navigate you back to the MailDesktop.aspx page.

    More ASP.NET Articles
    More By Xianzhong Zhu


     

    ASP.NET ARTICLES

    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...
    - Back-end Management Tasks for an ASP.NET AJA...
    - User Information Management for an ASP.NET A...
    - Adding Comments and Search to an ASP.NET AJA...
    - Order-Related Modules for an ASP.NET AJAX Se...
    - User and Role Management for an ASP.NET AJAX...
    - Programming an ASP.NET AJAX Server-Centric B...

    IBM developerWorks




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway