CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.web_parts_and_personalization Tags:
Item Type: NewsGroup Date Entered: 2/18/2008 5:04:00 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 7 Views: 40 Favorited: 0 Favorite
8 Items, 1 Pages 1 |< << Go >> >|
Mander
Asp.Net User
Only admin user able to edit web parts2/18/2008 5:04:00 PM

0

 Hi, I have a couple of web parts and a drop down to edit them that I want hidden from anyone apart from my admin user role. How would i go about doing this? I'm using C#.

vinz
Asp.Net User
Re: Only admin user able to edit web parts2/18/2008 5:37:35 PM

0

You can check for User.IsInRole() Method like

    if (User.IsInRole("Administrators")) {

       this.WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode; // EDITABLE WEBPARTS
    }
   
    else if (User.IsInRole("NormalUsers")) {

      this.WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode; //READ ONLY WEBPARTS
    }
   
    else {
        Response.Write("Invalid user");
    } 




Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post fixed your problem.


Mander
Asp.Net User
Re: Only admin user able to edit web parts2/18/2008 6:45:41 PM

0

 Cool, thanks, it's working!

 Two questions though - I've added some code to make the drop-down list (that I have to offer the various modes for web parts) invisible (see below) but it doesn't seem to make any difference - any ideas?
 

        else if (User.IsInRole("Users"))
        {

            this.wpManager.DisplayMode = WebPartManager.BrowseDisplayMode; //READ ONLY WEBPARTS
            MyDropDownList.Visible = false; // I've added this, but it doesn't work...
        }

 
Also, whenever the page is Invalid (e.g. you aren't logged in as an admin) the page font goes big/the formatting is messed up, any idea what this is?
 

vinz
Asp.Net User
Re: Only admin user able to edit web parts2/18/2008 6:55:31 PM

0

Can you post your aspx codes?

Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post fixed your problem.


Mander
Asp.Net User
Re: Only admin user able to edit web parts2/18/2008 7:05:52 PM

0

OK
vinz
Asp.Net User
Re: Only admin user able to edit web parts2/18/2008 7:25:37 PM

0

I think there' s no need for you to hide the DropDownList.. why not Filter the Items in the DropDownList based on the Roles something like

private void AdminOptions()
{
    DropDownList1.Items.Clear();
    DropDownList1.Items.Add("Normal View");
    DropDownList1.Items.Add("Design View");
    DropDownList1.Items.Add("Edit View");
    DropDownList1.Items.Add("Manage Webparts");

}
private void LimitedUserOprions()
{
    DropDownList1.Items.Clear();
    DropDownList1.Items.Add("Normal View");
    DropDownList1.Items.Add("Design View");
}

protected void Page_Load(object sender, EventArgs e)
{
 
   if (!page.IsPostBack)
   {
      if (User.IsInRole("Administrators")) {

       AdminOptions();
    }
  
    else if (User.IsInRole("NormalUsers")) {

       LimitedUserOprions();
    }
  
    else {
        Response.Write("Invalid user");
    }  
     
   }

}

 


Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post fixed your problem.


Mander
Asp.Net User
Re: Only admin user able to edit web parts2/18/2008 7:58:51 PM

0

OK, that works, thanks. The reason I wanted the drop-down to be invisible was mainly for asthetic purposes so the user can't see what the admin can edit. I'm still not sure about the formatting issue but I'll try messing about with it to see what happens... 

vinz
Asp.Net User
Re: Only admin user able to edit web parts2/18/2008 9:15:48 PM

0

Ok.. BTW if your issue was solve then dont forget to Mark helpful post(s) as Answers so that others can easily find those post they need..

Thanks 


Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post fixed your problem.


8 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
SharePoint 2007 user's guide: learning Microsoft's collaboration and productivity platform Authors: Seth Bates, Tony Smith, Pages: 407, Published: 2007
Essential SharePoint 2007 Authors: Jeff Webb, Pages: 428, Published: 2007
SharePoint 2003 user's guide Authors: Seth Bates, Tony Smith, Pages: 340, Published: 2005
Pro ASP.NET 2.0 website programming Authors: Damon Armstrong, Pages: 641, Published: 2005
BEGINNING MICROSOFT VISUAL C# 2008 Authors: Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Pages: 1344, Published: 2008

Web:
Data View Web Part, The Basics – Multiple Edit Forms | End User ... If you'd like users to be able to edit data in multiple records, ... This is what the data view web part will look like in the browser: ... Also, you can use this view to guide users to only edit certain fields here. ... Laura Rogers is currently a SharePoint Administrator at HealthSouth Corporation ...
Securing Web Parts Pages NET Web sites, although it is used only on pages that contain Web Parts controls . ... Users are able to modify the actual layout, appearance, ... For example, suppose you have a user who is designated as an administrator. ... and they can edit a server control by changing its layout, appearance, behavior, ...
User not able to see all web parts - HELP! - SharePoint Blogs ... I have a user that can not see all the web parts that are ... I see them when I go to the site (but I'm the Site Collection Admin) ... When he clicks Site Actions | Edit Page the list of available web parts shows up. ...
Using web parts in EPiServer - EPiServer Labs Administrator user has access to the 'Edit Web Parts' menu item. ... Hi, this is the downside, only for pre-R2 sites.. you would have to get the code at ...
SharePoint Web Parts - Community Server Some users may only be able to view the SharePoint page while others have ... You can modify Web Parts or create new Web Parts if your administrator has ... When you select Edit Page, an editable version of the current page displays. ... next to your user name in the upper-right corner of the SharePoint main page. ...

Only admin user able to edit web parts - ng.asp-net-forum ... Only admin user able to edit web parts, > ROOT > NEWSGROUP > Asp.Net Forum > general_asp.net.web_parts_and_personalization, Date: 2/18/2008 5:04:00 PM, ...
A problem with PartChromeStyle - ng.asp-net-forum ... Only admin user able to edit web parts - ng.asp-net-forum ... a problem with partchromestyle · getting a list of all pages and all web parts ...
Drag/drop from CatalogZone - ng.asp-net-forum ... Only admin user able to edit web parts - ng.asp-net-forum ... Hi, I have a couple of web parts and a drop down to edit them that I want hidden from .... how ...
Custom email editor in asp.net 2.0 - ng.asp-net-forum ... However, if I only type in "Dear Customer, . ... Personalize Your Portal with User Controls and Custom Web Parts ASP. ...
GetAllProfiles - Initialize not called in time? - ng.asp-net-forum ... Only admin user able to edit web parts - ng.asp-net-forum ... getallprofiles - initialize not called in time? title text of controls inside a webpart ...

Videos:
Editing a website using Freestyler CMS - Part 2 of 5 An example of the back-end admin system of a web content management system. From www.datalink.com.au
Who was the Mother of Jesus, the Christ? - Holy Spirit and ... Who was the Mother of Christ Jesus? - PART 1: - Christianity is for the twice born people of spirit and this has been stressed well by Christ ...
Dauger Research profiled on Keeping America Strong Dauger Research is the proud recipient of the "Keeping America Strong" award, part of a special television broadcast hosted by William Shatner ...
GeoServer and Architectures of Participation for Geospatial ... Google TechTalks August 23, 2006 Chris Holmes ABSTRACT This talk will introduce GeoServer, an open source server to publish and edit ...
Marco Borrillo vs. Robert Bryant Jr. - Arizona Open Singles ... Marco Borrillo vs. Robert Bryant Jr. - Arizona Open Singles RR - Table Tennis Ping Pong Tournament Arizona Online - Desert Table Tennis ...












seperate page for editor part

web part to show asp page

resetpersonalizationstate causing cast error

multiple values in sharepoint web parts

modifying personalization data

add webpart at run-time

image on popup menu

designing web parts for moss 2007

web part development in local machine or server

isn't there a way to create a webpart that can communicate with office? thanks

how to interact between webpart and manage events in moss 2007 ?

aspx file in sharepoint

help on populating the dropdown list for available webpartzones in catalogzone.

server control events in webpart

question about web parts

how to set the height of a webpartzone

dynamic update panels

when should i be using web parts

is this feasible?

add generic item to web.config

how to add text in to a webpart zone

showing editzone and conectionszone when the page is on catalogdisplay

accessing a control (ex. textbox) using javascript within a web part

setting the chrometype on a webpart does not seem to work.

change web part title bar color

complex web parts controls

where is the profile object?

gridview won't display in web part

webpartconnection

using reportviewer in a user control based web part

 
Search This Site:

 
  Privacy | Contact Us
All Times Are GMT