• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

LoginView Template Controls

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?
0
tkargel
Asked:
tkargel
  • 2
1 Solution
 
Bob LearnedCommented:
When the page is rendered, what does the LoginView control HTML look like from 'View Source' in the browser?

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

"btnLogout" is the linkbutton control name.
0
 
Bob LearnedCommented:
Try something like this:

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

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

  End Sub

Bob
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now