Hello Gurus.
I am working on ASP C#. Behind my code I have dynamically created few buttons based on its need, the code will run while Page_Load. Based on the database input, it will create the needed buttons.
For example, the button work as a delete function.
---------------------------------------------------------------------------------------------------
Once I open the page, the first delete button works fine.
Then --POST BACK > Page Refresh--
When I click on 2nd button, it does not fire the delete function but it will still perform as below
Then --POST BACK > Page Refresh--
I reclick 2nd delete buton, it works fine now.
Then --POST BACK > Page Refresh--
For the next few buttons, it will happen exactly like how 2nd button did
[/U]Conclusion: I have to press twice to let the method fire[U]
---------------------------------------------------------------------------------------------------
Obviously this has something to do with the lifecycle events of my program but is there any alternative?
But I wonder why will this happens since everytime it reloads, it will call my function to create those button (in Page_Load). Like how it works for the first time!
C# - Dynamically added button, Does not fire on first click