示例#1
0
 protected void lnkDelete_Click(object sender, EventArgs e)
 {
     try
     {
         objAttachmentcls = new AttachmentCls();
         objAttachmentcls.AttachmentHandle = Request.QueryString["ATH"];
         DataTable dtHandle = objAttachmentcls.GetHandleId();
         if (dtHandle.Rows.Count == 0)
         {
             int res = objAttachmentcls.DeleteHandle();
             if (res > 0)
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Deleted Successfully');", true);
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Not Deleted');", true);
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Attachment Handle used somewhere');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }