asp.net calling button click event that i created <p>I am writing a web app in asp.net. I have an aspx page that call a class (Test) that Generates a button and return the button. The class constructor get the function that the button click event should activate (userClickOnButton) and insert to the button.click += EventHandler("the name of the function (userClickOnButton)");</p> <p>the problem is that in the aspx behind code i use IsPostBack (cant take it off , need this Condition) and when i click on the button the progrem does not go to the event i created for the button, but when i take off the IsPostBack Condition the program does go to the event i created (the function userClickOnButton).</p> <p>my code is: aspx code behind</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Test test = new Test(userClickOnButton); Button button = test.AddButton(); cell.Controls.Add(button); } } private void userClickOnButton(object sender, EventArgs e) { this.ModalPopupExtenderSelectFilds.Show(); } </code></pre> <p>my class</p> <pre><code>public class Test { Action&lt;object, EventArgs&gt; m_ButtonClickActivateFunction; public Test(Action&lt;object, EventArgs&gt; func) { m_ButtonClickActivateFunction = func; } public Button AddButton() { Button button = new Button(); button.Text = "select"; button.ID = "buttonID"; button.Click += new EventHandler(m_ButtonClickActivateFunction); return button; } </code></pre> <p>need help to activate the event without taking out the IsPostBack Condition</p> <p>thanks</p>