How do I get the input from a user web cotnrol and build the control based on that?

A

Alex Stevens

Hi,

I'm building a user login control, which will accept a username and password
in textboxes and a checkbox to keep logged in - pretty much your
conventional login control.
When the user logs in, it writes a cookie to remember them, and if this
cookie exists when the control is run it just says, "Welcome back. - Click
here to logout"
It also has a hidden field, which indicates on postback the action the user
has selected, login / logout using an enum.

I've implemented INamingContainer, and IPostBackDataHandler to get the
information on postback.

The problem I have is that the control calls the CreateChildControls event
(in which I build the control in which ever form it should be) before it
calls the LoadPostData event.
This poses the problem that I can't build the control to look how it should
because I don't know what the action is until the LoadPostData event is run.

Interestingly, the order of the events changed once I implemented
INamingConatiner. Before I did that the LoadPostData event ran before the
CreateChildControls event???

So the question is, how do I dynamically build a control based on the
information retrieved in the LoadPostData event??

Thanks

Alex
 

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,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top