int count = 0;
RadioButton[] personRadio = new RadioButton[rowsPerson];
foreach (DataRow dataRow in dataTable.Rows)
{
string strFirtsname = dataRow["firstname"].ToString();
string strLastname = dataRow["lastname"].ToString();
personRadio[count] = new RadioButton();
personRadio[count].Name = personRadio[count].ToString();
personRadio[count].Text = strFirtsname + " " + strLastname;
personRadio[count].TabIndex = count;
personRadio[count].Location = new Point(20, count * 20);
personRadio[count].AutoCheck = true;
personPanel.Controls.Add(personRadio[count]);
personPanel.Visible = true;
count++;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
sqlConnection.Close();
}
}
Radio buttons are dynamically created based on the number of items that are in the database table(Person) which is working fine, my question is how do I get the selected value once i click any of this on the panel since they are dynamically created? Please help me out. Thanks. God bless in Jesus name.

New Topic/Question
Reply




MultiQuote





|