• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

postback not workign on usercontrol

so i have a user control that i load dynamically at run time into an asp:panel.
i use AJAX popup extender to make this panel a modal window showing the dynamically loaded user control.

the problem is the control fires events the first time and then when buttons on the UC are clicked like SAVE, DELETE, CANCEL there is no post back and the button click events dont execute.

how can I get the button events to work as expected on post backs?
0
realcoding
Asked:
realcoding
1 Solution
 
iHadiCommented:
Well, it's hard to say without seeing any code, but I suggest that you dynamically load you UC on page_init if you are not doing so (especially on postback)
0
 
Vikram Singh SainiSoftware Engineer cum AD DeveloperCommented:
Hi,

(1) Have you bind these all controls of your UC with some event handler?

(2) Is the AutoPostBack property of Controls is set to True.

Regards,
VSS
0
 
KiasChaos83Commented:
Hi there,

ASP.NET has a big gotcha with dynamically created controls. Did you know that with dynamically created controls, you need to re-create and re-add the controls to the page on EVERY page load? Not only that, you will find that with dynamically created controls their ViewState and their event will go missing or will not fire IF they aren't recreated on the page_init event.

If you are using dynamically created controls then you'll be wise to make sure you recreate them on every page_init.
0
 
realcodingAuthor Commented:
guys that seems to be all well and fine but even after i remake my UC on the init() event i dont get button clicks firing...

how will the UC know when to fire events?
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now