MailDesktop.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:2k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- public partial class MailDesktop : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- LoginLogic.MatchLoad("../", "MailDesktop");
- Response.Redirect("ViewMail.aspx?FolderID=1");
- if(!Page.IsPostBack)
- {
- BindFolderData();
- }
- }
- private void BindFolderData()
- { ///获取数据
- IFolder folder = new Folder();
- SqlDataReader dr = folder.GetFolders();
- ///绑定数据
- FolderView.DataSource = dr;
- FolderView.DataBind();
- dr.Close();
- }
-
- protected void NewFolderBtn_Click(object sender,EventArgs e)
- {
- Response.Redirect("~/NewFolder.aspx");
- }
- protected void FolderView_RowCommand(object sender,GridViewCommandEventArgs e)
- {
- if(e.CommandName == "delete")
- {
- try
- { ///删除数据
- IFolder folder = new Folder();
- folder.DeleteFolder(Int32.Parse(e.CommandArgument.ToString()));
- ///重新绑定控件的数据
- BindFolderData();
- Response.Write("<script>alert('" + "删除数据成功,请妥善保管好你的数据!" + "');</script>");
- }
- catch(Exception ex)
- { ///跳转到异常错误处理页面
- Response.Redirect("ErrorPage.aspx?ErrorMsg=" + ex.Message.Replace("<br>","").Replace("n","")
- + "&ErrorUrl=" + Request.Url.ToString().Replace("<br>","").Replace("n",""));
- }
- }
- }
- protected void FolderView_RowDeleting(object sender,GridViewDeleteEventArgs e)
- {
- ///
- }
- protected void FolderView_RowDataBound(object sender,GridViewRowEventArgs e)
- {
- ImageButton deleteBtn = (ImageButton)e.Row.FindControl("DeleteBtn");
- if(deleteBtn != null)
- {
- deleteBtn.Attributes.Add("onclick","return confirm('你确定要删除所选择的数据项吗?');");
- }
- }
- }