Bonjour,
ma question est simple et la réponse devrait l'être tout autant ... néanmoins je n'y arrive pas ..
Voici mon problème.
Lors d'une création de table HTML, je crée une colonne avec des RadioButton
après, lors d'une opération je souhaite récupérer l'index d'une ligne cochée...
Comment procéder?
Voici ma méthode qui devrait me retourner l'index de la ligne sélectionnée
Code C# :
private int GetIndexRow()
{
int rowIndex=-1;
int i=0;
foreach (HtmlTableRow row in WorksHtmlTable.Rows)
{
if (!row.Controls[0].ID.Contains("headerSelect"))
{
RadioButton rd = new RadioButton();
rd = (RadioButton)row.Controls[0];
if (rd.Checked == true)
rowIndex = i;
}
else i++;
}
return rowIndex;
}
et voici comment je crée ma colonne
Code C# :
HtmlTableCell select = new HtmlTableCell();
RadioButton rd = new RadioButton();
rd.GroupName = "BulletinSelection";
select.Controls.Add(rd);
row.Cells.Add(select);