try { con_data.con.Open(); string sql = "select * from t_qus_ans "; SqlCommand cmd = new SqlCommand(sql,con_data.con); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { HtmlTableRow row = new HtmlTableRow(); HtmlTableRow row1 = new HtmlTableRow(); HtmlTableCell cel1 = new HtmlTableCell(); Label lblqus = new Label(); cel1.Controls.Add(lblqus); Label label1 = new Label(); label1.Text = dr.GetValue(3).ToString(); cel1.Controls.Add(label1); cel1.ColSpan = 4; row1.Cells.Add(cel1); table2.Rows.Add(row1); for (int i = 4; i <8; i++) { HtmlTableCell cell = new HtmlTableCell(); RadioButton radioButton = new RadioButton(); Label lblno = new Label(); lblno.Text = "(" + (i-3).ToString() + ")"; cell.Controls.Add(lblno); radioButton.Text = dr.GetValue(i).ToString(); radioButton.GroupName = dr.GetValue(3).ToString(); radioButton.ID = dr.GetValue(i).ToString(); cell.Controls.Add(radioButton); row.Cells.Add(cell); } table2.Rows.Add(row); } } con_data.con.Close(); } catch (Exception ex) { } finally { if (con_data.con.State == ConnectionState.Open) { con_data.con.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)