コード例 #1
0
 protected void FreezeAllotments(object sender, EventArgs e)
 {
     try
     {
         DataTable dtfreeze = new DataTable();
         dtfreeze.Columns.Add("allot_id", typeof(string));
         int j = 0;
         foreach (GridViewRow gr in GVDistAllot.Rows)
         {
             if (((CheckBox)gr.FindControl("chkSelct")).Checked == true)
             {
                 dtfreeze.Rows.Add();
                 dtfreeze.Rows[j]["allot_id"] = ((Label)gr.FindControl("lblAllotedId")).Text;
                 j++;
             }
         }
         if (j == 0)
         {
             ObjCommon.ShowAlertMessage("Select atleast one row to freeze");
         }
         else
         {
             objBE.TVP    = dtfreeze;
             objBE.Action = "ADMIN";
             dt           = ObjDL.FreezeTargetDetails(objBE, con);
             if (dt.Rows.Count > 0)
             {
                 ObjCommon.ShowAlertMessage("Not freezed, try again");
             }
             else
             {
                 ObjCommon.ShowAlertMessage("data freezed");
                 GVDistAllot.DataSource = null;
                 GVDistAllot.DataBind();
                 BindGrid();
                 FreezedDataGrid();
             }
         }
     }
     catch (Exception ex)
     {
         // ExceptionLogging.SendExcepToDB(ex, Session["UsrName"].ToString(), Request.ServerVariables["REMOTE_ADDR"].ToString());
         // Response.Redirect("../Error.aspx");
     }
 }