LoginView in Gridview

Last post 11-22-2007 5:32 AM by Delinquent. 2 replies.

Sort Posts:

  • LoginView in Gridview

    11-21-2007, 12:30 PM
    • Loading...
    • Delinquent
    • Joined on 05-22-2005, 11:24 AM
    • North Wales, UK
    • Posts 142

    Hi,

    I want to be able to use an eval within a loginview nested within a gridview, the only problem is the <%#eval("id")%> is not rendering. Could anyone please help? I am really trying to avoid using a findcontrol on the rowcreated to find the panel and hiding it depending on whether the user is logged on or not.

    Many thanks in advance..

    Code Below :D

    <asp:GridView id="records"
            DataSourceID="data"
            DataKeyNames="id"
            AutoGenerateColumns="false"
            runat="server">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                       
                        <%#eval("id") %>
                        <strong><%#Eval("store")%></strong><br/>
                        <%#eval("address") %><br/>
                        <%#eval("postCode") %><br/>
                        <%#eval("region") %><br/>
                        <a href="http://forums.asp.net/AddPost.aspx?ForumID=24#">View Map</a>
                       
                        <asp:LoginView id="recordAdmin" runat="server">
                            <LoggedInTemplate>
                           
                                <div class="adminRight">
                                    <a href="store.aspx?store=<%#eval("id") %>">Edit Store</a> |
                                    <asp:LinkButton ID="btnDelete" Text="Delete" CommandName="Delete" OnClientClick="return confirm('Are you sure you wish to delete the store?');" runat="server"/>
                                </div>
                                
                            </LoggedInTemplate>
                        </asp:LoginView>
                       
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>      
        </asp:GridView>

    Filed under: , ,
  • Re: LoginView in Gridview

    11-21-2007, 1:11 PM
    • Loading...
    • onSlaught
    • Joined on 08-21-2007, 5:17 PM
    • a Phoenician
    • Posts 373

    I think it has to do with your quotes:

    <a href="store.aspx?store=<%#eval("id") %>">Edit Store</a>

    Try replacing the outer double quotes with single quotes...

    <a href='store.aspx?store=<%#eval("id") %>'>Edit Store</a>

    Please mark as "answer" if this helped you in anyway.
  • Re: LoginView in Gridview

    11-22-2007, 5:32 AM
    • Loading...
    • Delinquent
    • Joined on 05-22-2005, 11:24 AM
    • North Wales, UK
    • Posts 142

    Sorry this hasn't worked at all :(

    Really need to get this working

Page 1 of 1 (3 items)
Microsoft Communities
Page view counter