.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Show/Hide fields on InfoPath based on context User Group Membership

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :SharePoint
I am reading a book on SharePoint 2010 Development by Wrox and although it is a good book, the InfoPath section is limited. I am Googling to see if I can find anywhere where i can perhaps have this type of functionality to hide and show a specific field based on their Group Membership?
Victor Palma

View Complete Post

More Related Resource Links

Hide a measure group in excel 2007 'Show Fields Related to'


Hi All,

I know that if a I want to hide a measure group to users I have to set the properties 'Visible' to false for all the measure of the measure group.

But when I open a connection to the cube with Excel 2007 I see again the measure group in the drop down list 'Show Fields Related to' in the 'Pivot Table Fields List'.

I don't see it in the measure group list when I choose 'All' in the 'Show Fields Related to', but i don't want to see it in the list 'Show Fields Related to' too.


How I can do to hide permanently the measure group?


Thank you all,


NewForm.aspx - Show/Hide fields dynamically

I have about 20 + fields in a custom list.  I want to be able to show and hide fields depending on user selection.  Does anyone know a way of accomplishing this? Ive tried some embedded javascript but can't seem to get it working in sharepoint. Please help :)http://lbellows.blogspot.com http://www.ptreviews.net

UseExplicit property in infopath with form based context

Hi everyone, I have a problem with my infopath form. The context, user of the site mustn't have acces to lists that provision infopath form field. Administrator should have acces to these lists. When i test the useExplicit property of udc file for impersonate the connection to the list i have no problem ( all my account are local account) But when i try to integrate user from FBA, infopath form services don't take care of the UseExplicit property and try connect to the list with the credential of the connected user ( who don't have access to the list since only the user that i use to impersonate the connection have read acces). Here is my UseExplicit property :  <udc:Authentication>    <udc:UseExplicit CredentialType="NTLM">      <udc:UserId>dev\svc-reader</udc:UserId>      <udc:Password>password</udc:Password>    </udc:UseExplicit>  </udc:Authentication>    09/06/2010 15:06:50.46                w3wp.exe (0x09BC)                                      0x1A08 SharePoint Foundation                General                      

Infopath 2007 Repeating Table hide row based on Text values of column

Infopath 2007 browser based form Full Trust Example: I have a repeating table (FruitChoice) that has multiple columns. Both drop down list point to sharepoint list data sources. Choose your tree ft. drop down list – 6Ft Choose your Department drop down list - 103 This repeating table is conditional on the drop down values. This works great. Trees     Fruit       Cost   Date Ordered    Date Delivery Department 6Ft        Peaches                                                        103 3Ft        Apples                                                          102 3Ft        Peaches         &

Show or hide programmatically based on audience


I'm trying to either show or hide a datalist control based on a users Audience.

      AudienceLoader audienceLoader = AudienceLoader.GetAudienceLoader();

      string audienceFieldValue = "United States";

      if ((AudienceManager.IsCurrentUserInAudienceOf(audienceLoader, audienceFieldValue, false)))
        DataList2.Visible = true;
        DataList2.Visible = false;

I have tried couple different things this is where I'm at now... any help would be appreciated.




Get the user details based on the group


I am getting the details from groups but some groups have data but did not return any data is there any problem with this code. some groups have returned data .

CN=Tets App_Reviewer,OU=Tets Appl Groups,OU=District Wide Groups,DC=tets,DC=com;

Tets App_Reviewer is  the group name

public List<ADUserDetail> GetUserFromGroup(String groupName)
            List<ADUserDetail> userlist = new List<ADUserDetail>();


                _directoryEntry = null;

                DirectorySearcher directorySearch = new DirectorySearcher(SearchRoot);

                directorySearch.Filter = "(&(objectClass=group)(SAMAccountName=" + groupName + "))";

                SearchResult results = directorySearch.FindOne();

Hide Html table according to User Group

in my site i would like to hide an html table for specific user group , how do i do that with out using Visual Studio environment and with out using c# code is there any way that it can be done like in JavaScript , need a clear picture ....

Hide edit button on editform based on whether the user is item's creator


Hi Everyone


I would like to hide/show the edit button on a list item's edit form based on whether the user is the item's creator.  The reason I want to do this is because SharePoint's out-of-the-box behaviour is such that when a user edits someone else's item, the Access Denied page pops up AFTER the user makes his/her edits and presses ok.


My users want the edit button to be hidden so they don't have to go through the steps of making the edits, press ok, and then find out their access is denied.


I have done some research, and the approach I have arrived at is to create my own edit item user control, which has my own cutom code which checks if the user is the creator, and then hide/show the edit button.  I have 2 questions surrounding this:


1) Can anyone provide some advice or resources on the web which describes how to best implement an edit form user control and then integrate it into SharePoint so that the user control is only used on my particular list, and doesn't affect anything else in the site collection.


2) Can anyone suggest another approach perhaps requires less custom development effort than the custom user control approach?

Show users based on ad-security group or OU


Will it somehow be possible to show members of a AD group ?

We have some superusers, and they all have the ad-group: super_users.

Can i show all members somehow ?

Maybe by a search flag, so it is just a link to a search result ?

Jakob Olsen

SQL searches based on user selectable fields


This is the second time I've searched on this and came up not fully understanding why this isn't possible. Say you have one text box, but you want to be able for a user to search by "company name,"  "job number," or "Order No," So you put one text box and a drop down list where the user can select what field to search.

Here is what I would like to do  Select [order_no], [job_no], [company_name] From [order_tbl] WHERE @var1 Like '*@var2*'  (maybe not totally correct syntax, but you get the picture....and @var1 is set from the selection of the dropdownlist and @var2 is set from the text box).

What I do now is three separate SQL statements. If DropDownlist1.SelectedValue = 1 then do, if it = 2 then do, etc.

But when you have a large select statement with table joins, you have to make any changes three times, and it seems easy to make a mistake...not to mention if you have more than three choices, you have an SQL statement for each choice.

Am I misunderstanding that it isn't possible to do a variable field name so I can have one select statement to work with?  And if it isn't possible, I just wish I could wrap my head around why, because it seems such a simple thing to do.


Restict access to page fields. How to show field value to members of certain group?


I have the fields that should be shown for members of one group. How to implement this behavior?

Also i need to restrict access to editing other field for all except of limited amount of persons. How to do this?


All these questions are related to Site Content Types and Page Layouts.

Show/Hide Detailviews based on querystring


I have a form that has 2 querystring variables ID and FormID being passed to the page. Also on this page I have 2 different DataSources that outputs to a Detailview depending if the FormID is 1 or 2. I would like to be able to add a show/Hide command to Show only the DetailView that is selected and Hide the other. I have researched and found hat people are using a Multiview code, but I have not been able to find a working example code.  Does any one have any suggestions? I am currently using ASP.Net 2.0 and C#. Thanks for any help? 

How to hide the list column based on user login in SharePoint 2007

Hi, I have two different SharePoint group named 'Sales' group and 'HR' group. In a SharePoint list i have 10 columns. out of it i want to display 8 column for 'Sales' group and to show all the column for 'HR' group. I want to do this base on the user login. How can i achieve this?. Am using SharePoint 2007.

Client based InfoPath form User Roles: Order of Evaluation?

Again, client based (and no, this is a separate question from my other one, figured I'd ask them as separate threads).

To keep the example simple, let's assume I have 3 roles:  Administrator; Supervisor; Everyone.

Administrator is determined by your membership in a domain group, and this works great.  It's at the top of the list, so (according to MS), if it is evaluated that I'm in this role, execution stops, and that's my role.

Supervisor is determined if your name is in the 'Supervisor' field on the form (this works as well, even though my other post indicates it doesn't, but it doesn't in the context I'm using it there, so we'll move on and assume it works here).

Everyone else.

Now, if you are in the domain that evaluates to Administrator, that works great, until someone puts your name in the Supervisor field, then you evaluate to Supervisor.  This is wrong.  According to MS, it should still be evaluating Administrator first, and that is my role.  One of two things is happening:

1. MS is wrong, and it evaluates everything (I don't think this is the case, as I've tried changing the order of evaluation, and it still comes up Supervisor if my name is in that field, even though I'd normally come up as Administrator, based on my domain membership).

2. It evaluates i

Auto populate custom fields with values based on user selected in People Editor



I have a requirement wherein I want to populate the currently logged in user in people editor field of my custom web part and based on the user in people editor field, Also I should be able to select any other user if needed. I need to fill some other custom fields as well. I am able to get this quite easily. But suppose I remove the current logged user's name from people editor and enter some other name and then click on Check Names, then how do I change the custom fields based on the new user ?

    PeopleEditor peNameofFileRequestor = new PeopleEditor();
    TextBox txtPhoneNumber;
    TextBox txtDepartmentName;
    SPContext cnxtCurrent;

    protected override void CreateChildControls()

      cnxtCurrent = SPContext.Current;
      SPUser usrCurrent = cnxtCurrent.Web.CurrentUser;

      peNameofFileRequestor.MultiSelect = false;
      peNameofFileRequestor.SelectionSet = "User";
      peNameofFileRequestor.AutoPostBack = true;

      System.Collections.ArrayList entityArrayList = new System.Collections.ArrayList();
      PickerEntity entity = new PickerEntity();
      entity.Key = usrCurrent.LoginName;
      entity = peNameofFileRequestor.ValidateEntity(entity);

      Hashtable htEntityDa

Create user control fields based on bound properties



I am creating a user control that I would like to be able to generate the form entry fields based on what custom data object the form is bound to. Basically, I have a drop-down box that allows the user to pick what type of data object they are working with (user, address, etc.) That choice will bind the user control to the related data object. No big deal there. I am stuck, however, on how to generate the form fields based on the properties of the object. I feel like I have seen examples of this in WPF but am not able to find them now. All form fields will be simple label, textbox combinations in a stackpanel.

I know more detial will probably be required. Let me know what specifically you would like to know. Any help of direction is greatly appreciated.



Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend