ASP.NET
  Home arrow ASP.NET arrow Page 2 - 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 
Mobile Linux 
App Generation ROI 
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 Folders


    (Page 2 of 5 )

    Deleting folders is accomplished inside the MailDesktop.aspx page. To do so, you can just click the X button on the web page, and then the selected folders will be deleted.

    When we use Windows Explorer.exe to delete something, a dialog always appears to remind us of the possible danger. To achieve such an effect ourselves, we add the related code into the RowDataBound event of the FolderView control.

     

    protected void FolderView_RowDataBound(object sender,GridViewRowEventArgs e)

    {

      ImageButton deleteBtn = (ImageButton)e.Row.FindControl("DeleteBtn");

      if(deleteBtn != null)

      {

        deleteBtn.Attributes.Add("onclick", "return confirm('Are you sure to delete the selected item?');");

      }

    }

     

    Here, we first search for the button named DeleteBtn. If DeleteBtn is not null (i.e. exists or is found), then we bind a confirming dialog to it.

    The main task of making the deletion is done within the GridView's RowCommand event.

     

    protected void FolderView_RowCommand(object sender,GridViewCommandEventArgs e)

    {

      if(e.CommandName == "delete")

      {

        try

        { ///delete data

            IFolder folder = new Folder();

            folder.DeleteFolder(Int32.Parse(e.CommandArgument.ToString()));

     

          ///rebind the controls' data

            BindFolderData();

          Response.Write("<script>alert('" + "Deleting successfully,safekeep your 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, in the RowCommand event, we obtain the value of the CommandName property of the X button and save it in the CommandName parameter. Next, we get the value of the CommandArgument property and convert it into an integer which is stored in the nFolderID parameter. If all the requirements are satisfied, then we start to delete the selected folder, which is fulfilled by calling the  DeleteFolder (int nFolderID) function of the IDisk interface, removing the item (whose value of FolderID is nFolderID) from the database. And finally, an appropriate dialog appears to indicate whether or not the operation is successful.

    More ASP.NET Articles
    More By Xianzhong Zhu


     

    ASP.NET ARTICLES

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - 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





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT