LoginView Template Controls

Posted on 2007-07-31
Last Modified: 2013-11-26
I put a linkbutton control on the LoggedInTemplate of a LoginView control on a Master Page. I want to run some code when the linkbutton is clicked, but I don't see where to put the code. The linkbutton ID does not show in the page control list in VS2005. Is what I'm attempting valid and, if so, where do I put the code?
Question by:tkargel
    LVL 96

    Expert Comment

    by:Bob Learned
    When the page is rendered, what does the LoginView control HTML look like from 'View Source' in the browser?


    Author Comment

    <a id="ctl00_LoginView1_btnLogout" class="leftlinkswhite" href="javascript:__doPostBack('ctl00$LoginView1$btnLogout','')">LOGOUT</a>

    "btnLogout" is the linkbutton control name.
    LVL 96

    Accepted Solution

    Try something like this:

                <asp:LoginView ID="LoginView1" runat="server">
                        <asp:LinkButton ID="btnLayout" runat="server" OnClick="LayoutButton_Click"></asp:LinkButton>
                        <asp:RoleGroup Roles="Admin">
                        <asp:RoleGroup Roles="User">
                        <asp:RoleGroup Roles="ReadOnly">

      Protected Sub LayoutButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)

      End Sub


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now