tukky 0 Light Poster

Hey guys, Im working on a website that uses an access database to display food items from a menu. I have a login form/accounts made.

I want the admin to be able to EDIT the menu from within the website. But the customer is unable to edit the menu and can just see it as a whole.

Here is the code for the Login stuff:

  <asp:LoginView ID="LoginView1" runat="server">

            <RoleGroups>
                <asp:RoleGroup Roles="admin ">
                    <ContentTemplate>
                        admin - you have access to all areas
                    </ContentTemplate>
                </asp:RoleGroup>
                <asp:RoleGroup Roles="customer">
                    <ContentTemplate>
                        Customer - you have acess to all pages except those in AdminPages
                    </ContentTemplate>
                </asp:RoleGroup>
            </RoleGroups>
        </asp:LoginView>

and here is the code i have for when the admin can edit the database: (THIS IS JUST FOR THE PIZZAS TABLE)

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="ID" DataSourceID="AccessDataSource1" AllowPaging="True" 
            Width="766px">
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="ID" />
                <asp:BoundField DataField="Item Name" HeaderText="Item Name" 
                    SortExpression="Item Name" />
                <asp:BoundField DataField="Description" HeaderText="Description" 
                    SortExpression="Description" />
                <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
                <asp:BoundField DataField="Veg" HeaderText="Veg" SortExpression="Veg" />
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/Database- EDITED!.accdb" 
            DeleteCommand="DELETE FROM [Pizzas] WHERE (([ID] = ?) OR ([ID] IS NULL AND ? IS NULL))" 
            InsertCommand="INSERT INTO [Pizzas] ([ID], [Item Name], [Description], [Type], [Price], [Veg]) VALUES (?, ?, ?, ?, ?, ?)" 
            SelectCommand="SELECT * FROM [Pizzas]" 
            UpdateCommand="UPDATE [Pizzas] SET [Item Name] = ?, [Description] = ?, [Type] = ?, [Price] = ?, [Veg] = ? WHERE (([ID] = ?) OR ([ID] IS NULL AND ? IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="ID" Type="String" />
                <asp:Parameter Name="Item_Name" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Type" Type="String" />
                <asp:Parameter Name="Price" Type="Decimal" />
                <asp:Parameter Name="Veg" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Item_Name" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Type" Type="String" />
                <asp:Parameter Name="Price" Type="Decimal" />
                <asp:Parameter Name="Veg" Type="String" />
                <asp:Parameter Name="ID" Type="String" />
            </UpdateParameters>
        </asp:AccessDataSource>

I was wondering how i would link the above code to run ONLY when the admin has logged in??

Hope this helps

If you need anymore information then please just ask

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.