//First create the object of Button
Button b=new Button();
//suppose i want 5 button
for(int i=0;i<5;i++)
{
b.ID="b"+ i;
b.Text="Btn"+i;
b.Click +=new EventHandler(getvalue);
}
protected void getvalue(object sender,EventArgs e)
{
Button b1=sender as Button;
Response.Write(b1.ID);
Response.Write(b1.Text);
}
It Will display the id and text of particular button, when it get clicked
No comments:
Post a Comment