Same prob in a different view (add buttons)

R

Richard

(ASP.NET C#)
why doesn't this work

protected ArrayList editButtonArr;
public void showArticle()
{
editButtonArr = new ArrayList();
for (int i = 0; i < comments.Length; i++)
{
Button editButton = new Button();
editButton.Text = "Testing";
editButton.Click += new EventHandler(editButton_Click);
editButtonArr.Add(editButton);
}
}

private void editButton_Click(object sender, EventArgs e)
{
Response.Redirect("http://www.google.dk");
}

it is beeing run in the prerender of the Page

regards Richard
 
R

Robert Koritnik

Same problem. WHen posting back, no button recreation has been done. And
BTW: You don't have to take care of the ID's if the creation order is the
same as the first time. The framework will give them unique IDs. As long as
creation order stays the same.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,813
Members
47,357
Latest member
sitele8746

Latest Threads

Top