Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2007, 05:16 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trying to use a LoginView within a Repeater

I'm trying to limit what certain roles see in this repeater (namely the edit and delete links) but still allow them to have the read links. However this approach gives me the error:

'System.Web.UI.WebControls.LoginView' does not contain a definition for 'DataItem'

when I try to compile. Help me please.


...
<asp:Repeater id="repSearchResults" runat="server" OnItemCommand="repSearchResults_ItemCommand" >
<HeaderTemplate>
  <table>
    <TR>
      <TD><STRONG>Plat Number</STRONG></TD>
    </TR>
</HeaderTemplate>
<ItemTemplate>
    <TR>
      <TD>
        <a href="#####/####?id=<%# DataBinder.Eval(Container.DataItem, "PLAT_ID") %>"><%# DataBinder.Eval(Container.DataItem, "PLAT_ID") %> </a>
      </TD>
      <asp:LoginView ID="lvEditDelete" runat="server">
        <RoleGroups>
          <asp:RoleGroup Roles="Administrator, Plat Writer">
            <ContentTemplate>
              <TD>
                <asp:LinkButton ID="lbEditPlat" runat="server" CommandName="edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PLAT_ID") %>' CausesValidation="false">Edit</asp:LinkButton></TD>
              <TD>
                <asp:LinkButton ID="lbDeletePlat" runat="server" CommandName="delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PLAT_ID") %>' CausesValidation="false">Delete</asp:LinkButton></TD>
            </ContentTemplate>
          </asp:RoleGroup>
        </RoleGroups>
      </asp:LoginView>
    </tr>
</ItemTemplate>
<FooterTemplate>
  </table>
</FooterTemplate>
</asp:Repeater>
...

 
Old April 23rd, 2007, 09:48 AM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1 month later and still no response

 
Old April 23rd, 2007, 10:57 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It would seem that the "Container" in that context is the login control not the repeater. I don't know what is available on the "Container" object, but perhaps there is a parent that would get you back up to the repeater and then it would work.

I haven't used the login view so I'm no authority on what you can or can not do with it. But it would seem to me that using a login control in a repeating control is out of place. Why are you using it there, what are you trying to achieve?

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeater chiraagb ADO.NET 1 May 31st, 2004 02:35 PM
Repeater collie VB.NET 2002/2003 Basics 1 December 2nd, 2003 05:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.