示例#1
0
 private void BindData()
 {
     try
     {
         DataTable dt = new DataTable();
         if (Request.QueryString["AthHandle"] != null && Request.QueryString["Index"] != null && Request.QueryString["AttachedBy"] != null)
         {
             if (HttpContext.Current.Cache["ATHData"] == null)
             {
                 objAttachmentcls.AttachmentHandle = Request.QueryString["AthHandle"];
                 objAttachmentcls.IndexValue       = Request.QueryString["Index"];
                 dt = objAttachmentcls.GetAttachments();
                 HttpContext.Current.Cache.Insert("ATHData", dt, null, DateTime.Now.AddMinutes(20), TimeSpan.Zero);
             }
             else
             {
                 dt = (DataTable)HttpContext.Current.Cache["ATHData"];
             }
             if (dt.Rows.Count > 0)
             {
                 gvAttachment.DataSource = dt;
                 gvAttachment.DataBind();
                 divNoRecord.Visible       = false;
                 divViewAttachment.Visible = true;
             }
             else
             {
                 divNoRecord.Visible       = true;
                 divViewAttachment.Visible = false;
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('No Data found');", true);
         }
     }
     catch (System.Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }
示例#2
0
 private void BindData()
 {
     try
     {
         //if (Request.QueryString["AthHandle"] != null)
         //{
         objAttachmentcls = new AttachmentCls();
         objAttachmentcls.AttachmentHandle = ddlHandle.SelectedValue; //Request.QueryString["AthHandle"];
         objAttachmentcls.IndexValue       = ddlIndex.SelectedValue;  // Request.QueryString["Index"];
         DataTable dt = objAttachmentcls.GetAttachments();
         gvAttachment.DataSource = dt;
         gvAttachment.DataBind();
         //}
         //else
         //{
         //    ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('No record found');", true);
         //}
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Due to some technical issue record not found');", true);
     }
 }