Exemple #1
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {//Add Exception handilng try catch change by vishal 21-05-2012
     try
     {
         foreach (GridViewRow gv in grvwContract.Rows)
         {
             string gvIDs;
             // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
             CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
             // If deleteChkBxItem is Checked then ,mapped Current site to this user
             if (deleteChkBxItem.Checked)
             {
                 int contractid;
                 gvIDs      = ((Label)gv.FindControl("contractid")).Text.ToString();
                 contractid = Convert.ToInt32(gvIDs);
                 objContNotfy.Delete(contractid);
                 objContToAsset.Delete(contractid);
                 objContract.Delete(contractid);
                 BindGrid();
             }
         }
     }
     catch (Exception ex)
     {
         string myScript;
         myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>";
         Page.RegisterClientScriptBlock("MyScript", myScript);
         return;
     }
 }
Exemple #2
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow gv in grvwContract.Rows)
     {
         string gvIDs;
         // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row
         CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec");
         // If deleteChkBxItem is Checked then ,mapped Current site to this user
         if (deleteChkBxItem.Checked)
         {
             int contractid;
             gvIDs      = ((Label)gv.FindControl("contractid")).Text.ToString();
             contractid = Convert.ToInt16(gvIDs);
             objContNotfy.Delete(contractid);
             objContToAsset.Delete(contractid);
             objContract.Delete(contractid);
             BindGrid();
         }
     }
 }