Reputation: 11592
I have dynamically created a table in asp.net and Each cell in a row contains Option Button and Text Box respectively.The Option Buttons in a row are grouped.So,Only one Option Button Can be selected in a row.My Table contains m columns and n rows.
Now i want to get the selected Option Button value in each row when the form is submitted.
Above Table Contains 3 rows and 4 columns.
row :1 -> contains header. row :2 ->[2,0] is a option button,[2,1] is a text box,[2,2] is a Option,[2,3] is Text Box . . . Last Row -> is a sumbit button.
So Now i want to get the selected options button value of each row when submit button is pressed.
Please guide me to get out of this issue...
Upvotes: 0
Views: 320
Reputation: 19619
Try something like this
Note: Here tbl
is an instance of HtmlTable
control
foreach (TableRow row in tbl.Rows)
{
foreach (TableCell cell in r.Cells)
{
RadioButton r = c.FindControl("radiobuttonID");
// find your radiobutton & get needed values from that
}
}
Upvotes: 1