コード例 #1
0
 protected void gvChallan_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         DataTable   dtInfo = new DataTable();
         GridViewRow gvrow  = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
         hdChallanId.Value = gvChallan.DataKeys[gvrow.RowIndex].Value.ToString();
         // fill the Location information for edit
         if (e.CommandName == "DeleteEntry")
         {
             if (objMenuOptions.AllowDelete == false)
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('You do not have proper privilege for deleting a record.');", true);
                 return;
             }
             bool isDeleted = objLtmsService.DeleteInChallanById(Convert.ToInt64(hdChallanId.Value));
             if (isDeleted == true)
             {
                 BindChallanData(Convert.ToInt64(hdUniqueId.Value));
                 ScriptManager.RegisterStartupScript(this, GetType(), "MyMsg", "alert('Challan information deleted.');", true);
             }
         }
         dtInfo.Dispose();
     }
     catch (Exception Ex)
     {
         objValidateData.SaveSystemErrorLog(Ex, Request.UserHostAddress);
         var message = new JavaScriptSerializer().Serialize("Some Error has occurred while performing your activity. Please contact the System Administrator for further assistance.");
         var script  = string.Format("alert({0});", message);
         ScriptManager.RegisterClientScriptBlock(this, GetType(), "", script, true);
     }
 }