I am going to take this a step further. I think that your problem is much worse than what Sergey indicates. Let's break down what it is that you are doing:
LinkButton btnFile = new LinkButton();
for (int i = 0; i < convertedFiles.Count; i++)
{
foreach (var filess in convertedFiles)
{
Form1.Controls.Add(btnFile);
}
}
protected void button_Click(object sender, EventArgs e)
{
}
Now you are creating a button dynamically but you are adding the same button over and over. But it's worse than that. Take a look at your loops. You have what appears to be a list of strings(maybe) that you are iterating over. Then we get to the foreach where we iterate over the same collection again! Do you really want that? If your convertedFiles collection contained, say, 10 strings, your for loop runs 10 times and then your foreach adds 10 buttons on each iteration! That's a lot of buttons.
I think that your entire routine could be boiled down to the following and I believe that this is what you intended to do:
foreach (var filess in convertedFiles)
{
LinkButton btnFile = new LinkButton();
btnFile.Text = "Download file for agency " + Agencynumber + "<br>";
btnFile.ID = filess;
btnFile.Visible = true;
btnFile.Click += new System.EventHandler(button_Click);
Form1.Controls.Add(btnFile);
}
protected void button_Click(object sender, EventArgs e)
{
}
Move the button creation to the foreach loop and get rid of the for loop altogether.