protected void Gridtrash_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int de = MAdapter.Delete(Convert.ToInt32(Gridtrash.DataKeys[e.RowIndex].Value));

        MDT = MAdapter.sELECTfor_trace(Session["email"].ToString());
        Gridtrash.DataSource = MDT;
        Gridtrash.DataBind();
    }
 protected void linktrashdelete_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < Gridtrash.Rows.Count; i++)
     {
         CheckBox chkk = Gridtrash.Rows[i].FindControl("chk") as CheckBox;
         if (chkk.Checked == true)
         {
             // MAdapter.MAILMST_SELECT_DO_TRASH(Convert.ToInt32(GridView1.DataKeys[i]["ID"].ToString()));
             int del = MAdapter.Delete(Convert.ToInt32(Gridtrash.DataKeys[i]["ID"].ToString()));
         }
     }
     MDT = MAdapter.sELECTfor_trace(Session["email"].ToString());
     Gridtrash.DataSource = MDT;
     Gridtrash.DataBind();
 }
    protected void Gridtrash_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        // MAdapter.update_inboxmail(Convert.ToInt32(Gridtrash.DataKeys[e.RowIndex].Value));
        //MDT = MAdapter.SelectFORINBOX(Session["email"].ToString());
        /////   Gridtrash.DataSource = MDT;
        // Gridtrash.DataBind();

        if (e.CommandName == "res")
        {
            MAdapter.update_inboxmail(Convert.ToInt32(e.CommandArgument.ToString()));
            MDT = MAdapter.sELECTfor_trace(Session["email"].ToString());
            Gridtrash.DataSource = MDT;
            Gridtrash.DataBind();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         MDT = MAdapter.sELECTfor_trace(Session["email"].ToString());
         Gridtrash.DataSource = MDT;
         Gridtrash.DataBind();
     }
     if (Gridtrash.Rows.Count == 0)
     {
         litrash.Visible         = false;
         linktrashdelete.Visible = false;
     }
     else
     {
         litrash.Visible         = true;
         linktrashdelete.Visible = true;
     }
 }