VS 2010 - Hide DIVs Based On Roles

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


Similar Messages:

JQuery :: Toggle Multiple Divs / Failed At Each Attempt To Put Code In A 1 - 6 Loop To Hide All Divs?

Jan 31, 2011

I was just after some help to put the following code into a loop. I have 6 div's with id's ImgDetails1 - ImgDetails6 and 6 buttons
with id's 1 - 6

if 1 is pushed it should hide the other divs but ensure div1 is shown. the same applies for every other
div.

I can do this the long way writing logic for each div but I am not the best with js and have failed
at each attempt to put the code in a 1 - 6 loop to hide all divs except the one selected and make sure that is shown.

[Code]....

View 4 Replies

Hide ActionLinks Based On User Roles?

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

Web Forms :: Hide Sub Menu Items Based On Roles?

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

How To Show / Hide Custom Menu Items As Based On Roles

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

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

Security :: How To Hide Multiple Roles With Roles.getallroles()

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

Web Forms :: Hide Divs On The Initial Load And Make Them Appear On A Postback Event?

Dec 1, 2010

I have several divs on an asp page. All of my divs are runat="server". On the initial load of my page I set all the divs visible property to false because I dont want them to appear on the first show. Then, I have a drop down list raising postback events.

On the selected index changed event I am setting the visible property of my divs to true to make them appear on the page. However this does not work.

I discovered that, on the initial load non of my divs are added to the page's html content. So, on a postback event non existing divs can not be made to appear. If all the divs would set to visible = true on the initial load, postback event would work just expected.

Could any one tell me a way to hide divs on the initial load and make them appear on a postback event?

View 3 Replies

Security :: Hide / Denied Access To Page Base On Roles?

Nov 11, 2010

Will someone point me to a tutorial on how to hide and denied access to certain pages based on what roles the user is in?

View 8 Replies

Security :: Redirecting Based On Roles C#?

Oct 5, 2010

I'm trying to redirect users upon login based on their roles which were defined in the Administer website feature of asp.net.Heres what I'm trying protected void Login1_LoggedIn(object sender, EventArgs e)

View 2 Replies

Web Forms :: Login Based On Roles

May 7, 2015

I create a login where both the super admin users can also login into it and the general users can also login into it..

If the super admin user logins he must land on the separate page and the general users must login to a separate page...

How it is possible...

View 1 Replies

AJAX :: Restrict Tabs Based On Roles?

Mar 1, 2010

I am currently working on a website with a Tab Container with roughly 5-10 tabs. I would like to have an Admin tab that is disabled to all users except those who are assigned in an Admin role (I have 2 roles, Admins and Customers). I am fairly new to ASP.NET so please bare with me. I have been crashing through it for about 3 weeks now, trying to help a friend get a site up and running!

View 6 Replies

Security :: Equivalent For LoginView Based On Roles?

Apr 21, 2010

I have a website where users can login and they have different roles/privileges. I want to have it where the user's view of the webpage is determined by their role. Right now I am storing the role in the UserData property of the FormsAuthenticationTicket class (which is retrieved from a database during login). When the main page is loading, I want it to check the user's role and then only show the controls/portions of the page that are for that role. For example, if the user is not an administrator, they shouldn't be able to click on a button to delete a record. At the moment I am using labels to hide or show areas depending on the user's role. Something like this:

[Code]....

[Code]....

And here is a portion of the markup code with the Labels:

[Code]....

This works, but doesn't seem to be a very good way to handle this type of thing. Is there a cleaner, more elegant way of doing this? Something similar to the LoginView control, but which I can use for roles?

View 4 Replies

Security :: Redirect To Different Folders Based On Roles?

Jul 4, 2010

I have implemented membership and enable role based on. I have 2 roles "admin" and "super_admin" and once the user login, I want to redirect them to different folder based on their role. My guess is, the redirection need to be determined once the user clicked login on the login control and here is my code.

[Code]....

However, whenever the user login (regardless of admin or super_admin) the page keeps redirection to Anyone/Default.aspx.

View 5 Replies

Hierarchical SQL Roles Based On Default RoleProvider

Feb 11, 2011

I'm trying to implement the following adjustments to the default ASP.NET RoleProvider so that it supports hierarchical role definitions. However i cannot create the following function, it keeps Executing the function.

Ref: [URL]

What is wrong with this function?

-- Template generated from Template Explorer using:
-- Create Multi-Statement Function (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the function.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
CREATE FUNCTION [dbo].[aspnet_Roles_Ancestor_TVF] (
@RoleId uniqueidentifier
)
RETURNS
@aspnet_Roles TABLE (
ApplicationId uniqueidentifier
, RoleId uniqueidentifier
, RoleName nvarchar(256)
, LoweredRoleName nvarchar(256)
, Description nvarchar(256)
, ParentRoleId uniqueidentifier
)
AS
BEGIN
; WITH aspnet_Roles_CTE (
ApplicationId
, RoleId
, RoleName
, LoweredRoleName
, Description
, ParentRoleId
, HierarchyLevel
) AS (

[Code.....]

View 2 Replies

User Permissions On Certain Views Based On Roles?

Feb 23, 2011

I am using ASP.NET MVC 3. We assign roles to certain people at work, then we use Windows authentication to determine what roles a user has. Lets say the roles are RoleA, RoleB and RoleC. So now I get a list of roles for a user. Lets says that UserA belongs to RoleA and RoleB. Some of my views need to be authenticated as not everyone can view certain views. Lets say that ViewA can only be viewed by users that belong to roles RoleA and RoleB. How would I do this? What would I need to look into? When a user that does not belong to these roles tries to access the views then he/she should be redirected to an error page.

View 1 Replies

VS 2010 Mixed Authentication With Roles

Dec 13, 2011

I have the requirement for internal users to acces our web app without loggin in manually so using windows authentication, external users need to be refered to a form based authentication.

Now I have implemented the solution [URL] ....

However I also need to employ roles for authorization. The forms side is all set up but I cannot seem to get it to work for the windows side of things, looking for implementing a mixed mode involving roles?

I tried adding in an extra provider

<providers>
<add name="SqlRoleManager" type="System.Web.Security.SqlRoleProvider" connectionStringName="aspnetdbConnection_dev" applicationName="Corp.Web.GSP"/>

but how to configure it for usse only by the windows users. Secondly if I set it as the default where I have code like

if (Roles.IsUserInRole("Internal") || Roles.IsUserInRole("SysAdmin") || Roles.IsUserInRole("Sales"))
{

I get an

Method is only supported if the user name parameter matches the user name in the current Windows Identity error

<add name="WindowsRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />

View 5 Replies

Security :: Send User To Different Pages Based On Their Roles

Nov 19, 2010

I'm using the built-in membership controls and classes to manage authorization and authentication in my app. Here's what I want to do: If the user is in "Manager" role, I want to send him/her to the manager page no matter where he/she came from. If the user is in "Supervisor" role, I want to send him/her to supervisor page no matter where he/she came from. However, if the user is not in any role, just a registered member, I want to send him/her back to where he/she came from as stated in ReturnUrl. If no, ReturnUrl is specified, I will send him/her to the home page.

On my login page, I'm using the Login server control but in my code behind, there's no method wired to the control because the control takes care of everything. I assume I need to add a method and wire it to the submit button, is that right? If so, I'll have to really handle the login event which means I'll need more info about how to do that.

View 6 Replies

Security :: Trying To Get Roles To Populate A Checkboxlist Based On Tutorial?

Aug 17, 2010

I have been using the following tutorial and had to convert the code to C# for my project, now i cant get the code to work, im getting red line under the word "in" in the UpdateRolesFromList,
i tried to add a datasource on page load for the checkboxlist like so RoleList.DataSource = PopulateRoleList(User.Identity.Name.ToString());and gives me error saying cannot implictly convert type 'void' to 'object'
[URL]What am i missing, that when i load the page or even do a search it never displays the checkbox list as it shows in the tutorial?

[Code]....

View 7 Replies

SiteMap Based On User Roles Doesn't Works?

Sep 22, 2010

I have sitemap which looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/default.aspx" title="Prva stran" roles="*" description="Shema ISEF">
<siteMapNode roles="2" title="Analize" id="Analize" description="" >
<siteMapNode url="~/karneki1.aspx" title="Karneki1" description="" />
<siteMapNode url="~/karneki2.aspx" title="Karneki2" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>

if I set roles in a siteMapNode with title "Analiza" it works fine, the link is not shown in the navigation... but if I set roles on any of "karneki" siteMapNode the links are still visible...

Is it even posible to restrict access to lower links based on user role?

View 1 Replies

Security :: Redirect To Specific Web Page Based On Roles?

Oct 26, 2010

Is there a tutorial on how to redirect user to a specific web page based on his/her role? For example, I have teacher role and student role. When the teachers login, it will redirect the teacher to the teacher web page and the students redirected to the student web page.

View 1 Replies

C# - Handling Multiple Roles In MVC - Action-based Accessibility?

Mar 29, 2011

I currently have a project that I seem to have ran into an issue regarding Roles and thought I would get some opinions on how to best handle the problem. The system will require editable, flexible roles that control not only the access of specific areas, but also the use of system functions (Adding Users, Editing Users, Viewing Reports etc.)The system currently allows users to have multiple roles, each of those roles has explicitly defined areas of access/actions, for example:

Role A can access areas 1,2,3 and can Add Users.
Role B can access areas 1,5,7 and can Modify Users.
Role C can access areas 4,6 and only View Users.

so a User could be in Roles A and C, and thus access : 1,2,3,4 and 6, and could Add and View Users.My first solution was to create a dictionary that would store all of the possible areas of access/access options into a Dictionary like so:

Dictionary<string,bool>

then when it is instantiated it pulls all of the properties from the database and then iterates through the roles to determine if they are accessible.All of that currently works just fine - however the project is quite Javascript/jQuery intensive so many of these options are called by client-side functions. I am trying to avoid having to wrap all of these client side functions with:

<%if(AccessDictionary[key])
//Enable or Disable Action
<%}%>

I am wondering about the following things: After a user logs in, what is the best way to store this Dictionary? Statically? In the Session?What would be the best method of storage such that the Dictionary will be easily accessed in the View? (As I currently see no way around wrapping my client-side functions)!

View 1 Replies

How To Allocate Tasks To Users Based On Roles In Membership

Jul 11, 2012

My application have 2 Roles. Admin and Student. I created some tasks for these 2 roles by using LoginView ( Edit RoleGroup). As user login both can see there allocated tasks. 

But I want to allocate some admin tasks to some student(s) not for all. How can I do it?

View 1 Replies

Security :: How To Redirect To Specific Page Based On User Roles

Sep 12, 2010

I am using Formsauthentication. My situation is as per below:

the login form has codebehind :

protected void LoginButton_Click(object sender, EventArgs e)
{
TextBox uname = Login1.FindControl("UserName") as TextBox;
TextBox pass = Login1.FindControl("Password") as TextBox;
CheckBox rm = Login1.FindControl("RememberMe") as CheckBox;
Literal fail = Login1.FindControl("Literal1") as Literal;
if (Membership.ValidateUser(uname.Text, pass.Text))

[Code].....

Now the problem is that when I try to login with proper credentials it first redirects to default.aspx( there is no such page in my project), after login again with same credentials it properly redirects to the correct page. Why such problem arises? to fix this?

View 6 Replies

Architecture :: Implement Field Level Security Based On The Roles

Jul 22, 2010

I need to implement field level security based on the roles. I have a page Employee.aspx . In that i have ten controls. If i am enter as admin role i need to show all the controls. If i am enter as user have to show only five controls. How to design the appplication for control level security?

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved