R
Raj
Hi there,
I am trying to get this work but I can't figure a solution. I have a
table on a web page (.aspx) and creating the table contents
dynamically. I have two cells for each row of table. First cell is a
label field, and second is a radiobuttonlist. Table looks some thing
like
Your favorite color? *)Red *)Blue *)Green
Age? *)20 *)30 *)40
Here comes the problem. In the submit button, I am trying to read the
selection as follows:
RadioButtonList rbl;
TableCell tc;
string sText;
int nTotal = tblStats.Rows.Count;
for (int i = 0; i < nTotal; i++)
{
tc = tblStats.Rows.Cells[1];
rbl = (RadioButtonList)tc.Controls[0];
sText = rbl.SelectedItem.Value;
}
The above code will always return the first selection (In the above
example: Red, 20 etc) Even if you select Blue, 40 etc. Actually that's
what the default selections were when page loads.
I have googled it but couldn't find what I was looking for. I will
truly appreciate your input.
Thank you,
Raj
I am trying to get this work but I can't figure a solution. I have a
table on a web page (.aspx) and creating the table contents
dynamically. I have two cells for each row of table. First cell is a
label field, and second is a radiobuttonlist. Table looks some thing
like
Your favorite color? *)Red *)Blue *)Green
Age? *)20 *)30 *)40
Here comes the problem. In the submit button, I am trying to read the
selection as follows:
RadioButtonList rbl;
TableCell tc;
string sText;
int nTotal = tblStats.Rows.Count;
for (int i = 0; i < nTotal; i++)
{
tc = tblStats.Rows.Cells[1];
rbl = (RadioButtonList)tc.Controls[0];
sText = rbl.SelectedItem.Value;
}
The above code will always return the first selection (In the above
example: Red, 20 etc) Even if you select Blue, 40 etc. Actually that's
what the default selections were when page loads.
I have googled it but couldn't find what I was looking for. I will
truly appreciate your input.
Thank you,
Raj