Web Forms :: Hide Menu Control Items Conditionally Based On Roles
Aug 12, 2013
I have written code for menu with web.sitemap and SiteMapDataSource1.I want to hide the admin panel if user has no admin rights.
How there is relation between sitemapdatasource,web.sitemap and menu.
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
<asp:Menu ID="Menu" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
OnMenuItemDataBound="OnMenuItemDataBound" onmenuitemclick="Menu_MenuItemClick" Width="100%">
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass="main_menu" />
[Code] .....
View 1 Replies
Similar Messages:
Jul 23, 2013
I have menu item on which come from website map. I have trimmed the main item of menu based on user roles.
Like i have one menu in which i have 5 reports i want to show 2 reports to agents and 5 reports to admin. how to apply roles on sub menu item.
View 1 Replies
Mar 12, 2010
I have a custom menu, which leverages the standard asp.net sitemap. It works well but some of my pages are dynamically generated by URL rewriter, so they don't sit in the sitemap XML file. At the moment I rolled a custom solution which shows/hides menu items via CSS class and a programmatic check of the role that the user is in. It works ok until I visit a dynamic page that doesn't exist in the sitemap file. I've tried the "roles" attribute in the sitemap file with security trimming but it isn't working because I have a custom menu.
Is there a way I could leverage the roles attribute in the sitemap file to show/hide menu items for my custom control below, even when some pages are not in the sitemap? My menu control is below...
<div class="menu">
<ul>
<asp:Repeater ID="rpt" runat="server" DataSourceID="smdsMenuPrimary"
EnableViewState="False">
<ItemTemplate>
<li class="<%#GetDisplayClass((SiteMapNode)Container.DataItem)%>"><a href='<%# ((SiteMapNode)Container.DataItem).Url %>'><%# ((SiteMapNode)Container.DataItem).Title %></a></li>
</ItemTemplate>
</asp:Repeater>
</ul>
View 1 Replies
Apr 8, 2013
What I want is to show menu items Administrator or show user menu items.Show menu items using login...How I can do it with role provider, control menu and siteMap in masterpage?
View 1 Replies
May 11, 2010
How can I hide some items in my menu if you are just a user & only appears if you log in as administrator? I would like to hide the siteadmin. Below is the code:
[Code]....
View 7 Replies
Jun 30, 2010
I have a site that was working fine with security. I needed to create my own RoleProvider to give the ability to add Groups to roles based on certain criteria which I successfully did.
The problem is, since then, my main site (a Single Sign On Site) will not show the proper menu items for my users roles. The funny part is that right after I publish it, or restart the application, it works fine. Once it has been running for awhile, I lose my menu items.
If I manually type in the URL to go to one of the pages that I cannot see the menu item and perform some function, all of a sudden all my menu items reappear.
View 1 Replies
Jul 8, 2010
In a standard, generated list view, how can I hide certain ActionLinks based on the roles the logged in user belongs to?
View 1 Replies
Mar 26, 2012
I have a bunch of divs that are widgets. I am using a custom role provider and I need to hide the divs based on roles. Is it better to add a "runat=server" attribute to the div so that I can hide/unhide in the code behind? Should I hide/unhide on the aspx page or do i use panel controls and hide/unhide in the code behind?
View 1 Replies
Feb 3, 2011
Currently I have a menu control on my webform in ASP.Net 4.0 :
<div class="PNMenu">
<asp:SiteMapDataSource ID="PNSiteMap" runat="server" ShowStartingNode="false" />
<asp:Menu ID="PNMainMenu" runat="server" DataSourceID="PNSiteMap" RenderingMode="List" Orientation="Horizontal" CssClass="PN-PrimaryNavMenu" >
</asp:Menu>
</div>
I am trying to style the menu control to allow the menu items to float to the right of the container, however I am unable to do so as whenever I am styling the a, ul or li it keeps getting overidded by asp.net and floats everything left.
.PNMenu
{
clear:both;
[code]...
View 5 Replies
Jul 13, 2010
I hv created menu using sitemap xmldatasource now i want to display that based on Category or Roles. I have Created 4 Category in my sql Server 2005. when particular user logged in based on his Category menu nodes should display.
View 7 Replies
Jun 22, 2012
how to align the menu bar with proper space
View 1 Replies
May 25, 2010
I have a navigation menu I would like to display based upon user roles (using.net membership) After several hours and headaches (from banging my head against the desk) I was wondering if someone can point me in the error of my ways.
[Code]....
[Code]....
How can I ensure that when the user is logged in, the appropriate menu items are displayed on the Landing page? Still new to all of this and my current method of 'trial and error' has seen me reach suicide levels this morning!
View 5 Replies
Jan 1, 2014
I am making the asp.net application which consist of 6 form n based on user id pass want to show form e.g.: for admin all form appear for finance only 2 form appear when he enter his login id pass how can I?
View 1 Replies
Apr 24, 2015
I have placed an aspx menu control on my master page with orientation as Horizontal. Below is HTML markup.
HTML Code:
<asp:Menu ID="mnuMedChem" runat="server" Orientation="Horizontal" Width="100%" OnMenuItemClick="mnuMedChem_MenuItemClick">
<DynamicHoverStyle CssClass="DynamicHover" />
<DynamicMenuItemStyle CssClass="DynamicMenuItem" />
[Code]....
I have tried populating the menus from my database by using the
Code:
mnuMedChem.Items.Add
and
Code:
mnuMedChem.FindControl(value).ChildItems.Add
The menu items and the childs are populating correctly but then the menu is not being displayed on the menu control.
View 4 Replies
Mar 11, 2013
I have 2 page admin.aspx page and search.aspx
in admin .aspx page I have textbox=txtsearch and image button=imgs
in txtsearch we can type Mobile Or phoneNumber and when we click on Imgs we go to search.aspx page
below are code
protected void imgs_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("admin/search.aspx?Mobile=" + Server.UrlEncode(Txtsearch.Text));
}
in search.aspx page I have gridview that bind from database and show data according to Mobile or PhoneNumber that I typed in txtsearch in admin.aspx below are code
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" CssClass="DGridViewSV"
AutoGenerateColumns = "false" Font-Names = "Tahoma"
Font-Size = "9pt"
[Code].....
Now I want when I enter Mobile in txtsearxh and click button when it go to search.aspx page it in grid view it show Mobile number in HLcalss from database and it doesn't show PhoneNumber and Code in Hyperlink1 and lblCode
and if I type phoneNumber in txtsearch in gridview it showes PhoneNumber and Code and it doesn't Show Mobile number
View 1 Replies
Feb 22, 2010
I need a help in creating a vertical oriented Menu control with dynamic url's set in there Navigate Url property.Also i need to set the menu items as enable/disable in two different modes say edit/new.
View 1 Replies
Jul 10, 2010
I added a menu avigation control in my page and i did this:
<div style="background-color: Maroon">
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" ForeColor="Black" Font-Bold="true"
BackColor="Chocolate">
<Items>
<asp:MenuItem Text="Home"></asp:MenuItem>
<asp:MenuItem Text="About Us"></asp:MenuItem>
<asp:MenuItem Text="Services"></asp:MenuItem>
<asp:MenuItem Text="Careers"></asp:MenuItem>
<asp:MenuItem Text="Contact Us"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
but i cant give proper spacing between the menu items right now it is appearing like this: how to give proper spacing between the menu items them?
View 14 Replies
Jan 21, 2010
My web app has 3roles, I need to lock down certain sitemap menu items based on the users role and what I'm using isn't working.
my roles are Supervisor, manager, and User.
[Code]....
I only want those roles to see those menu options, I do not want someone with a user role to see those options at all. Currently if I log into my site with a user role, I'm seeing everything on the menu (via the sitemap).
View 5 Replies
May 13, 2013
I have a page with a label and a textbox with two button edit and update. when the user clicks on edit the labels get hidden and text box appears. And when he clicks on update the textbox disappears and label appears I have achieved making the text box disappear and label appear but when I click on edit the textbox is not appearing ....
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Institute : System.Web.UI.Page {
[Code] ....
View 1 Replies
Nov 12, 2010
I have the following Menu control:
[Code]....
How do I hide the root node and some other nodes if I do not want it to show on the navigation menu?
View 15 Replies
Mar 7, 2011
I have a multi level application that I am developing and need to block multiple rows from being joined. I know how to hide one role but I cannot figure out how to hide multiple.
Here is my current code
[Code]....
View 2 Replies
Feb 5, 2011
How can i have a menu control that Manage SiteMapNode from the menu to hide and Just when admin logged to see it.
[Code]....
View 1 Replies
Aug 26, 2010
I'm trying to conditionally hide 2 link buttons within a Gridview(gvPosts), ModifyButton and DeleteButton. I want the two buttons to hide in every row where the currently logged on Username is not the same as the Username in gvPosts' lbEmpID, a LinkButton control in the same row. Unfortunately the code is hiding the buttons in every row, including the one where lbEmpID.text = Profile.Username. My code is below, what am I doing wrong?
Dim lbtn As LinkButton
For Each rowItem As GridViewRow In gvPosts.Rows
lbtn = DirectCast(rowItem.Cells(0).FindControl("lbEmpID"), LinkButton)
If lbtn.Text <> Profile.UserName Then
Dim Modify As LinkButton
Dim Remove As LinkButton
For Each rowItem1 As GridViewRow In gvPosts.Rows
Modify = DirectCast(rowItem1.Cells(0).FindControl("ModifyButton"), LinkButton)
Remove = DirectCast(rowItem1.Cells(0).FindControl("RemoveButton"), LinkButton)
Modify.Visible = False
Remove.Visible = False
Next
End If
'If chk.Checked Then
'Response.Write(chk.ClientID + "<br />")
'End If
Next
View 3 Replies
Aug 22, 2010
I have for example a ASP Menu control having a static (File) and dynamic (Open, New) menu such as :
[code]....
I am able to see this menu under VS 2008 under my development PC. But when I deploy the app to a IIS server, and run the app, the whole app appeared the same. Only the Menu has "File" for selection but the submenu items (Open and New) did not appear when the mouse cursor was moved over "File". Only the Outline of the dropdown box of the submenu appeared.
View 2 Replies
May 24, 2010
dv = new DataView(table);
Table.Columns.Add("ID", typeof(string));
table.Columns.Add("Type", typeof(string));
table.Columns.Add("EmpName", typeof(string));
table.Columns.Add("Manager", typeof(string));
row = table.Rows.Add();
row["ID"] = result["ID"].ToString();
row["Type"] = result["Type"].ToString();
row["EmpName"] = result["EmpName"].ToString();
row["Manager"] = result["Manager"].ToString();
Then I am adding boundfield to gridview for all 4 columns. Now I want to check if "Type" column contain "Sales" thne do not show "Manager" columns. Let me know can I do this?
View 4 Replies