I know this question was asked many times, but still my problem is not solved,
I'm trying to iterate on a list of objects, and fill a template "user control" with that object, like result list of a search.
in these user controls there is a linkButton which should redirect to another page, when I click on that linkButton nothing happens, I googled it but no satisfying answer.
here is the code, I'll illustrate with button instead of a user control:
protected override void OnInit(EventsArgs e)
{
for(int i=0;i<10;i=i+1)
{
Button b = new Button();
b.ID = "Button" + i;
b.Click += new System.EventHAndler(this.Button_OnClick);
Controls.Add(b);
}
base.OnInit(e);
}
private void Button_OnClick(object Sender,System.EventsArgs e)
{
Response.Redirect("~/Some.aspx");
}
public override void VerifyRenderingInServerForm(Control control)
{
return;
}
It never calls the Button_OnClick method.
Thanks in advance.