I'm creating a Button on a ComboxChanged Event,
Button btn = new Button();
btn.ID = "btnNum1";
btn.Text = "Edit";
btn.Click += btnTest_Click;
pnl.Controls.Add(btn);
The event code is as followed
public void btnTest_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
Response.Write(btn.ID);
Response.Redirect("Page2.aspx");
}
I have tried, both Response.Write and Response.Redirect. None of them, works.
Same page gets refreshed. Does any one has any idea.
Button has to be created Dynamically, hence I can't try the Page_Init
I have also tried the CommandArgument event that also didn't work. Any idea.