Click to See Complete Forum and Search --> : Problem with radio button event handler in WebForm


joecre
May 2nd, 2008, 05:24 AM
Hi everyone, I've the following problem with a WebForm, in my application on Form PageLoad I've added some codelines in order to add a radio button inside a TableRow, all seems to works fine except eventhandler management, no event is fired when I click on radio button control
Can someone suggest me a solution?
Here you are my code

protected void Page_Load(object sender, EventArgs e)
{
TableRow oTabRow = new TableRow();
TableCell oTabCell = new TableCell();

RadioButton myCustRB = new RadioButton();
myCustRB.ID = "Test";
myCustRB.Text = "Test";
myCustRB.CheckedChanged += new EventHandler(Clicked);
oTabCell.Controls.Add(myCustRB);
oTabRow.Controls.Add(oTabCell);
Table1.Controls.Add(oTabRow);

}
public void Clicked(object sender, EventArgs e)
{
Response.Write("Clicked");
}

hspc
May 2nd, 2008, 06:39 AM
Please use Code tags when you post code.
Set AutoPostBack to true
myCustRB.AutoPostBack = true;