some time we need to add a Number of same controls to the Page. Following is the code:
Button[] BtnArray=new Button[10];
for (int i = 0; i < 10; i++)
{
BtnArray[i] = new Button();
BtnArray[i].Width = 100;
BtnArray[i].Text = @"Button " + i.ToString();
Page.Form.Controls.Add(BtnArray[i]);
BtnArray[i].Click += new EventHandler(TestMe_Click);
}
void TestMe_Click(object sender, EventArgs e){
Label1.Text = ((Button)sender).Text;
}