using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;
public partial class exam : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void function()
{
my e = new my();
SqlConnection sqlcon = new SqlConnection(e.ImportantData);
SqlCommand sqlcmd;
sqlcmd = new SqlCommand("usp_exam1", sqlcon);
sqlcmd.Parameters.AddWithValue("@rowno", '1');
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcon.Open();
sqlcmd.ExecuteScalar();
SqlDataAdapter da = new SqlDataAdapter(sqlcmd);
DataSet ds = new DataSet();
da.Fill(ds);[CODE][/CODE]
RadioButton[][] radioButtons = new RadioButton[3][];
TableRow[] tr = new TableRow[3];
TableCell[][] tc = new TableCell[3][];
if (ds.Tables[0].Rows.Count > 0)
{
int j=0;
int i = 0;
Table tb = new Table();
form1.Controls.Add(tb);
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
for(int k=1;k<5;k++)
{
DataRow dtr = ds.Tables[0].Rows[j];
tr[j] = new TableRow();
tb.Controls.Add(tr[j]);
tc[i][j] = new TableCell();
[COLOR="Red"]radioButtons[i][j] = new RadioButton();[/COLOR]
radioButtons[i][j].Text = dtr["Option"+"k"].ToString();
tr[j].Controls.Add(tc[i][j]);
tc[i][j].Controls.Add(radioButtons[i][j]);
}
}
}
}
else
{
Response.Write("wrong user id and password");
}
sqlcon.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
function();
Response.Write("done");
}
}
I am creatig dymaic 12 radio button in the series of 4(option) but I am getting error(red line).
as I am very new to asp.net I am not able to handle it