/// <summary> /// Save Event. Datatable type parameter has been passed as argument /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnsave_Click(object sender, EventArgs e) { try { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { DataTable dt = new DataTable(); dt.Columns.Add("ID"); dt.Columns.Add("Key"); dt.Columns.Add("DisplayName"); dt.Columns.Add("Display"); dt.Columns.Add("Confidential"); dt.Columns.Add("value"); dt.Columns.Add("userid"); for (int j = 0; j < GridView1.Rows.Count; j++) { DataRow dr = dt.NewRow(); Label lbID = GridView1.Rows[j].FindControl("lblID") as Label; Label lbKey = GridView1.Rows[j].FindControl("lblKey") as Label; Label lbDN = GridView1.Rows[j].FindControl("lblDisplayName") as Label; CheckBox lbDisplay = GridView1.Rows[j].FindControl("chkDisplay") as CheckBox; CheckBox lbConf = GridView1.Rows[j].FindControl("chkConfidential") as CheckBox; dr["ID"] = Convert.ToInt32(lbID.Text); dr["Key"] = lbKey.Text; dr["DisplayName"] = lbDN.Text; dr["Display"] = lbDisplay.Checked ? 1 : 0; dr["Confidential"] = lbConf.Checked ? 1 : 0; if (lbKey.Text == "Addressformat") { RadioButton rdbDisplay = GridView1.Rows[j].FindControl("rdbDisplay") as RadioButton; RadioButton rdbConf = GridView1.Rows[j].FindControl("rdbConf") as RadioButton; if (rdbDisplay.Checked) { dr["value"] = 0; dr["Display"] = 1; dr["Confidential"] = 0; } else { dr["value"] = 1; dr["Confidential"] = 1; dr["Display"] = 0; } } else { dr["value"] = null; } dr["userid"] = int.Parse(Session["USERID"].ToString()); dt.Rows.Add(dr); } int x = obj.CRW_UpdateConfig(dt); if (x > 0) { bindGridView(); Response.Write("<script type='text/javascript'>"); Response.Write("alert('Crew details configuration has been updated successfully.');"); Response.Write("document.location.href='Crew_Details_Configuration.aspx';"); Response.Write("</script>"); } } else { Response.Write("<script type='text/javascript'>"); Response.Write("document.location.href='Crew_Details_Configuration.aspx';"); Response.Write("</script>"); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }