473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Why LoginView cannot be added to PlaceHolder?

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?

Apr 28 '07 #1
1 1242
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)

Morgan Cheng wrote:
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?
Apr 30 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kalyani | last post by:
Hi, I am using a PlaceHolder in a Datagrid. At runtime either a TextBox or DropDownList is added to this placeholder. Now on click of a button I want to read value from this control. But the...
2
by: Sam | last post by:
I have a custom control (MyTextBox - taken from Microsoft website) that implements the IPostBackDataHandler interface. It is added to the controls collection of a placeholder control during the...
1
by: Angel | last post by:
I have added controls to the placeholder control. All the controls that were added have EnableViewState = true including the placeholder. One of the controls has a button that performs a postback. My...
0
by: Casey | last post by:
Hello. I'm using the loginview control. There are 2 default templates. The 'LoggedInTemplate', and the 'anonymoustemplate'. However, I also have a template (or view?) for the admin role. How do I...
1
by: Phil | last post by:
I have gridview with a templatefield in which is a loginview. The loginview displays a delete linkbutton for a specified group only. when a record is delete the loginview displays the contents of...
0
by: Sean Sims | last post by:
recently added a LoginView to an existing page, it now looks like this: <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="AtPress.aspx.cs" Inherits="AtPress"...
3
by: =?Utf-8?B?am1obWFpbmU=?= | last post by:
When I put asp controls inside the LoginView it removes the codebehind references so that the page will not build. For example: <asp:LoginView ID="LoginView" runat="server" > <LoggedInTemplate>...
4
by: Chris | last post by:
I have some code which adds controls to a placeholder. The button and label however always appears above the dynamically added content when the actual tags are below. Why is this. I want them to...
2
by: Jeff | last post by:
Hey ASP.NET 2.0 I'm about to start programming a new website at work. My boss want's me avoid using the Membership system in ASP.NET 2.0 (probably because he don't understand how it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.