c# code to handle dynamic command button

protected void Page_Load(object sender, EventArgs e)
{
protected System.Web.UI.WebControls.Button btnTest;
string str;
str="A";
btnTest = new Button();
btnTest.ID = str;
btnTest.Text = str;
btnTest.Width=40;
btnTest.Height = 30;
Form.Controls.Add(btnTest);
btnTest.Click += new EventHandler(A_Click);
}
protected void A_Click(object sender,EventArgs e)
{
//handle operation
}

Comments

Popular Posts