Why LoginView cannot be added to PlaceHolder?

M

Morgan Cheng

I tried to add a LoginView control in OnClick eventhandler of a
button.
The code is like below

LoginView login = new LoginView();
PlaceHolder1.Controls.Add(login);

After run the page, I click the button and nothing happens.

If I change LoginView to a Label, it shows.
Why this happens? Should I set some properties to LoginView before add
it to PlaceHolder Control?
 
B

bruce barker

on postback your code has to remember it added on the LoginView on page
render. the LoginView needs to be re-add in the postback oninit.
otherwise there is no control to handle the postback data.

-- bruce (sqlwork.com)
 

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,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top