ascx problem

L

Lyuba

Hi
I have a problem with user controls in asp.net

I have an aspx page that has a System.Web.UI.WebControls.PlaceHolder. On page load I have code that loads page1.ascx control on the placeholder. page1.ascx has button "next", on click it clears placeholder on aspx page and loads page2.ascx on the placeholder
The problem is on page2.ascx. It has "next" button but on click only client side processing works. In my page2.cs I have routine that supposed to store data to a db and then clear placeholder and load next control. I've debugged it step by step - it never gets into the next click event handler

What am I doing wrong? Please help

Thank you in advanc

Lyuba
 
V

Victor Garcia Aprea [MVP]

Hi Lyuba,

If you are loading the UC in a postback event (a click for instance) then
all its child controls won't fire events propertly as it is just too late as
key events have already been fired. Please take a look in the docs at how
the Control lifecycle works to learn what events are fired and in which
order.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

Lyuba said:
Hi,
I have a problem with user controls in asp.net.

I have an aspx page that has a System.Web.UI.WebControls.PlaceHolder. On
page load I have code that loads page1.ascx control on the placeholder.
page1.ascx has button "next", on click it clears placeholder on aspx page
and loads page2.ascx on the placeholder.
The problem is on page2.ascx. It has "next" button but on click only
client side processing works. In my page2.cs I have routine that supposed to
store data to a db and then clear placeholder and load next control. I've
debugged it step by step - it never gets into the next click event handler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top