SqlConnection con1 = new SqlConnection(main.ConnString); SqlCommand cmd1 = new SqlCommand(); cmd1.CommandText = "SELECT * FROM [main_settings] WHERE [usertype] = 'webadmin' AND [status] = 'active'"; cmd1.Connection = con1; List<string> l1 = new List<string>(), l2 = new List<string>(); List<bool> l3 = new List<bool>(); int counter = 0; con1.Open(); SqlDataReader r1 = cmd1.ExecuteReader(); while (r1.Read()) { l1.Add(r1.GetString(2).ToString()); l2.Add(r1.GetString(4).ToString()); string tempstr = r1.GetString(5).ToString(); if (tempstr.ToLower() == "true") { l3.Add(true); } else { l3.Add(false); } counter++; } string[] temptooltip = new string[counter], tempmainstring = new string[counter]; bool[] tempstat = new bool[counter]; TableHeaderRow h1 = new TableHeaderRow(); TableHeaderCell hc1 = new TableHeaderCell(); TableHeaderCell hc2 = new TableHeaderCell(); hc1.Text = "Web Page"; hc2.Text = "Status"; h1.Cells.Add(hc1); h1.Cells.Add(hc2); webadminTable.Controls.Add(h1); for (int i = 0; i < counter; i++) { CheckBox ctemp = new CheckBox(); TableRow temptr = new TableRow(); TableCell tc1 = new TableCell(); TableCell tc2 = new TableCell(); ctemp.Checked = tempstat[i]; ctemp.ToolTip = temptooltip[i]; tc1.Text = tempmainstring[i]; tc2.Controls.Add(ctemp); temptr.Cells.Add(tc1); temptr.Cells.Add(tc2); webadminTable.Rows.Add(temptr); ctemp.Dispose(); tc1.Dispose(); tc2.Dispose(); temptr.Dispose(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)