Ok I am changing entire question. I want to generate n*2 rows datatable i.e if primary datatable contains 3 rows , newly created datatable will contain 6 rows (1 row is for True option and 1 row for False option.)
so lets say I have a primary/main table as follows
question_text|right_option
-------------|------------
Question 1 | True
-------------|------------
Question 2 | False
-------------|------------
Question 3 | True
So question 1's right option is true,question 2's right option is False and so on..
Now based on this table I want to create a table as follows..
question_text|option_text * | right_option
-------------|--------------|-------------
question 1 | True | True
-------------|--------------|-------------
question 1 | False | True
-------------|--------------|-------------
question 2 | True | False
-------------|--------------|-------------
question 2 | False | False
here option_text is hard coded column whose value will be True and False only..
table (nx2) goes as follows...
DataTable dtTrueFalse = Import_To_Grid(FilePath, Extension, "Yes"); // primary table where only right option exist
for (int i = 0; i < dtTrueFalse.Rows.Count * 2; i++)
{
DataRow dr;
if (i % 2 == 0)
{
dr = dtOptions.NewRow();
dr["Option_Text"] = "True";
}
else
{
dr = dtOptions.NewRow();
dr["Option_Text"] = "False";
}
dtOptions.Rows.Add(dr);
}
after creating I will have this ..
question_text|option_text | right_option
-------------|--------------|-------------
question 1 | True |
-------------|--------------|-------------
question 1 | False |
-------------|--------------|-------------
question 2 | True |
-------------|--------------|-------------
question 2 | False |
Now, I wanna know how to insert value into right_option column?Please help me out..