Help: Calling ID of Dynamic Created Radio Buttons

I am doing the following asp.net web page, and dynamically creating radio buttons giving them a specific id. now i would like that when the user clicks 'edit', i will be able to get the id of the 'checked' radio button! any ideas? here is my coding at the moment...

[size=1] String[] linksText = dlink.Split('|');
for (int i = 0; i < linksText.Length - 1; i++)
{
if (ds.Tables[0].Rows[i][2].ToString() == "")
{
AddObjectwithLink(ds.Tables[0].Rows[i][4].ToString(), linksText[i].ToString());
}
else
{
AddObjectwithFilePath(ds.Tables[0].Rows[i][2].ToString(), linksText[i].ToString());
}
}

private void AddObjectwithLink(string downloadlink, string text)
{
TableRow tableRow = new TableRow();
TableCell tableCell = new TableCell();

rb = new RadioButton();
rb.ID = "rb" + text;
rb.GroupName = "filesGroup";
//rbList.ID = "radioButtonList";
//rbList.Controls.Add(rb);

tableCell.Controls.Add(rb);

HyperLink link = new HyperLink();
link.Text = text;
link.NavigateUrl = ("downloads.aspx?ID=" + downloadlink);
link.Target = (downloadlink);

tableCell.Controls.Add(link);
tableRow.Cells.Add(tableCell);
LTable.Rows.Add(tableRow);
}
private void AddObjectwithFilePath(string downloadlink, string text)
{
TableRow tableRow = new TableRow();
TableCell tableCell = new TableCell();

rb = new RadioButton();
rb.ID = "rb" + text;
rb.GroupName = "filesGroup";

//rbList.ID = "radioButtonList";
//rbList.Controls.Add(rb);

tableCell.Controls.Add(rb);

HyperLink link = new HyperLink();
link.Text = text;
link.NavigateUrl = ("~\UploadedFiles\" + downloadlink);
link.Target = ("~\UploadedFiles\" + downloadlink);

tableCell.Controls.Add(link);
tableRow.Cells.Add(tableCell);
LTable.Rows.Add(tableRow);
}[/size]

thanks guys

Comments

  • Hi,

    as I understand Your code You add RadioButtons to a control-collection.

    Just run through that and find what You
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion