|
-
May 2nd, 2008, 05:24 AM
#1
Problem with radio button event handler in WebForm
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
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");
}
Last edited by PeejAvery; May 2nd, 2008 at 07:57 AM.
Reason: Added code tags.
-
May 2nd, 2008, 06:39 AM
#2
Re: Problem with radio button event handler in WebForm
- Please use Code tags when you post code.
- Set AutoPostBack to true
Code:
myCustRB.AutoPostBack = true;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|