Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

postback not workign on usercontrol

Posted on 2010-08-13
4
Medium Priority
?
275 Views
Last Modified: 2013-11-07
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
Comment
Question by:realcoding
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 13

Expert Comment

by:iHadi
ID: 33433504
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
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33434859
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
 
LVL 5

Accepted Solution

by:
KiasChaos83 earned 2000 total points
ID: 33436123
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
 

Author Comment

by:realcoding
ID: 33445547
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question