using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; /// /// Summary description for ShowHide /// public class ShowHide { //SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["con"]); SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString); public ShowHide() { // // TODO: Add constructor logic here // } public void tbl_ShowHide(ref CheckBox chkbox, ref HtmlTable tbl, ref Label err) { try { if (chkbox.Checked == true) { tbl.Visible = true; } else if (chkbox.Checked == false) { tbl.Visible = false; } } catch (Exception ex) { err.Text = "Error : " + ex.Message; } } public void tbl_ShowHide2(String sel, string id, ref CheckBox chkbox, ref HtmlTable tbl, ref Label err) { try { if (con.State== ConnectionState.Open) { con.Close(); } string qry ="Select " + sel + " from tbl_DomainMaster where Id=" + id + ""; SqlCommand cmd1 = new SqlCommand(qry, con); SqlDataReader dr1; con.Open(); dr1 = cmd1.ExecuteReader(); if ((dr1.Read())) { if (dr1[sel].ToString().Trim()=="Yes") { chkbox.Checked = true; tbl.Visible = true; } else if (dr1[sel].ToString().Trim()=="No") { chkbox.Checked = false; tbl.Visible = false; } } } catch (Exception ex) { err.Text = "Error : " + ex.Message; } } public void Set_Services(ref CheckBox chkbox, ref string str, ref Label err) { try { if (chkbox.Checked == true) { str = "Yes"; } else if (chkbox.Checked == false) { str = "No"; } } catch (Exception ex) { err.Text = "Error : " + ex.Message; } } }