예제 #1
0
 private void BindAllAttachments()
 {
     try
     {
         DataTable dt = new DataTable();
         if (HttpContext.Current.Cache["ALLATHData"] == null)
         {
             objAttachmentcls = new AttachmentCls();
             dt = objAttachmentcls.GetAllAttachments();
             HttpContext.Current.Cache.Insert("ALLATHData", dt, null, DateTime.Now.AddMinutes(20), TimeSpan.Zero);
         }
         else
         {
             dt = (DataTable)HttpContext.Current.Cache["ALLATHData"];
         }
         if (dt.Rows.Count > 0)
         {
             gvAttachment.DataSource = dt;
             gvAttachment.DataBind();
             divNoRecord.Visible       = false;
             divViewAttachment.Visible = true;
         }
         else
         {
             divNoRecord.Visible       = true;
             divViewAttachment.Visible = false;
         }
     }
     catch (System.Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }