ASP.NET
  Home arrow ASP.NET arrow Page 4 - Finishing an Online E-Mail System in ASP.N...
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 
Moblin 
JMSL Numerical Library 
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


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


    (Page 4 of 5 )

    It's comparatively easy to delete email, which is accomplished in the DeleteBtn_Click event on the ViewMail.aspx page.

     

    protected void DeleteBtn_Click(object sender,EventArgs e){

      ///create a new instance of class Mail

        IMail mail = new Mail();

        try {

          foreach(GridViewRow row in MailView.Rows)

        { ///find your control

          CheckBox checkMail = (CheckBox)row.FindControl("CheckMail");

          if(checkMail != null)

          {

            if(checkMail.Checked == true)

            {

          ///execute the requested operation on the database

        mail.DeleteMail(Int32.Parse(MailView.DataKeys[row.RowIndex].Value.ToString()));

            }

          }

        }

      ///rebind the data to the control

        BindMailData(nFolderID);

      }

      catch(Exception ex)

      { ///jump to the page responsible for dealing exception

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

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

      }

    }

     

    As is seen from above, we first find the ID value matching each e-mail to be deleted in the mail list control named MailView, and then invoke the DeleteMail method of the Mail object, which is finished through a typical for loop sentence. Here, remember that after deleting the selected e-mail, you have to rebind the data to MailView (i.e. refresh).

    More ASP.NET Articles
    More By Xianzhong Zhu


     

    ASP.NET ARTICLES

    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - 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...





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