Why LoginView cannot be added to PlaceHolder?

  • Thread starter Thread starter Morgan Cheng
  • Start date Start date
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?
 
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

Back
Top