User Controls...

A

ASPWannabe

I'm kind of lost about user controls...

If
A)I have a UserControl UC which I include in a Page P
B)I have form Elements in UC (Its a login form)

When I click the 'Submit' button (Included in UC) do I
build all the events in the asCx.cs codebehind file, or in
the asPx.cs codebehind?
 
Y

Yunus Emre ALPÖZEN [MCAD.NET]

Surely whole page is posted back but events raised in user controls should
be handled in user control.

Let me explain event mechanism in ASP.NET. Before ASP.NET it is nearly
impossible to built up an event based system for a web based application.
(Event were only possible in windows forms) How ASP.NET achieve this? Answer
is simple using viewstate. After posting page to server side. First of all
ASP.NET builts up previous page from the viewstate. Then calls page_load
event at every post. Then controls click events, like a button click. If a
button is clicked your form sends a variable to indicate event raiser. Then
controls changed events (comparing current values and previous values and
then raises event). I hope, something is more clear which you confused up
 

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

Top