This project has moved. For the latest updates, please go here.

Customize UsersDisp.aspx and FBA/

Mar 25, 2014 at 2:24 PM
Edited Mar 25, 2014 at 2:25 PM
FBA/Management/UsersDisp.aspx and FBA/Management/UserNew.aspx

On these pages, I have a requirement to add a new column/form entry called "Company" so that the admin can sort and modify user per company.

Right now, the listings are UserName, Email, Active, Locked, and so on. If I could add one more column for "Company" that would be great. Please let me know if this can be done and how.

Thanks,

Jonathan
Coordinator
Mar 25, 2014 at 3:35 PM
It can be done. The easiest way to do it would be to search for 'email' in the code and then duplicate the email code for Company. Note that email is set both in the membership database and on the sharepoint user's profile. You'll only want to make the SharePoint profile updates for Company.
Mar 25, 2014 at 4:11 PM
Hi, thanks for your response. I opend up the FBA/Management?UserNew.aspx code and searched for email and found the code block below:

<wssuc:InputFormSection runat="server" Title="<%$ Resources:FBAPackWebPages, EmailColHeaderText %>">
        <template_inputformcontrols>
            <asp:Label ID="lblEmailMessage" runat="server" Text="" ForeColor="red"></asp:Label>
            <wssuc:InputFormControl runat="server" LabelText="<%$ Resources:FBAPackWebPages, TypeEmailAddrLabelText %>">
                <Template_Control>
                <SharePoint:InputFormTextBox Title="<%$ Resources:FBAPackWebPages, EmailColHeaderText %>" class="ms-input" Columns="40" maxlength="255" ID="txtEmail" Direction="LeftToRight" Runat="server" autocomplete="off" />
                <SharePoint:InputFormRegularExpressionValidator ID="InputFormRegExpressionFieldValidator1"  ControlToValidate="txtEmail" Display="Dynamic" runat="server" ValidationExpression=".+\@.+" ErrorMessage="Enter a valid email address."/>
                </Template_Control>
            </wssuc:InputFormControl>
        </template_inputformcontrols>
    </wssuc:InputFormSection>
How would I modify this for Company?
Mar 25, 2014 at 5:08 PM
Edited Mar 25, 2014 at 5:08 PM
Also curious, do I need to add to the FBAPackWebPages file for the web applicaton in question?

I got an error stating that the CompanyColHeaderText was invalid so I'm wondering if I need to add to the FBAPackWebPages file below to something similar

<data name="EmailColHeaderText" xml:space="preserve">
<value>Email Address</value>
Thoughts?
Coordinator
Mar 25, 2014 at 5:39 PM
Yeah - the "resources" items are pulling values from resource files, which you'll also find in the solution. They allow the text to be translated to multiple languages. If you're only going to be using this internally in a single language you could just replace the resource entries with the actual text you want to appear.

I'll put it out there too that we do customization for customers as well. From what you've mentioned I expect the changes can be done within the 6 hours that are included with the FBA Pack support plan, which can be purchased here:

http://www.visigo.com/purchase.html
Mar 25, 2014 at 6:58 PM
So there is there a way add columns to the SPGridview below that resides in the UsersDisp.aspx file? When I do, I get an error on this page. Not sure how to modify the view or datasource in this file.

<SharePoint:SPGridView ID="MemberGrid" runat="server" DataSourceID="UserDataSource"
    AutoGenerateColumns="false" AllowPaging="true" PageSize="20" AllowSorting="true">
    <Columns>
        <SharePoint:SPMenuField HeaderText="<%$ Resources:FBAPackWebPages, UserNameColHeaderText %>" TextFields="Name" MenuTemplateId="UserMenu"
            NavigateUrlFields="Name" NavigateUrlFormat="UserEdit.aspx?UserName={0}" TokenNameAndValueFields="USERNAME=Name"
            SortExpression="Name" />



        <SharePoint:SPBoundField DataField="Email" HeaderText="<%$ Resources:FBAPackWebPages, EmailColHeaderText %>" SortExpression="Email">
        </SharePoint:SPBoundField>


        <SharePoint:SPBoundField DataField="Title" HeaderText="<%$ Resources:FBAPackWebPages, FullNameColHeaderText %>" SortExpression="Title">
        </SharePoint:SPBoundField>
        <SharePoint:SPBoundField DataField="Active" HeaderText="<%$ Resources:FBAPackWebPages, ActiveColHeaderText %>" SortExpression="Active">
        </SharePoint:SPBoundField>
        <SharePoint:SPBoundField DataField="Locked" HeaderText="<%$ Resources:FBAPackWebPages, LockedColHeaderText %>" SortExpression="Locked">
        </SharePoint:SPBoundField>
        <SharePoint:SPBoundField DataField="LastLogin" HeaderText="<%$ Resources:FBAPackWebPages, LastLoginColHeaderText %>" SortExpression="LastLogin">
        </SharePoint:SPBoundField>
        <SharePoint:SPBoundField DataField="IsInSharePoint" HeaderText="<%$ Resources:FBAPackWebPages, IsInSharePointColHeaderText %>" SortExpression="IsInSharePoint">
        </SharePoint:SPBoundField>
        <SharePoint:SPBoundField DataField="Modified" HeaderText="<%$ Resources:FBAPackWebPages, ModifiedColHeaderText %>" SortExpression="Modified">
        </SharePoint:SPBoundField>
        <SharePoint:SPBoundField DataField="Created" HeaderText="<%$ Resources:FBAPackWebPages, CreatedColHeaderText %>" SortExpression="Created">
        </SharePoint:SPBoundField>

    </Columns>
</SharePoint:SPGridView>
Mar 25, 2014 at 6:59 PM
I see "Department" is part of the User Information List, is there a way to pull this column in to the gridview above and rename it to something else?
Coordinator
Mar 25, 2014 at 7:26 PM
You'll want to take a look at FBADataSource and FBAUsersView - that's why I mentioned you'll need to search the whole solution for "email".
Mar 25, 2014 at 8:40 PM
I've added the form field of "Company" for New user and Edit user (FBA), but not sure where this writes to, is it supposed to write to the membership database, and will I need to modify the stored procedure?

Also, not sure where to look to modify the FBAUsersView and FBADataSource, I only see them referenced once, which is in the UsersDisp.aspx file. Any thoughts?

I appreciate your help on this.
Coordinator
Mar 26, 2014 at 1:21 AM
I would store the Company field in the SharePoint user profile.

The files are in the Code\Data folder
Mar 26, 2014 at 2:39 PM
How would I add the Company field to the SharePoint user profile? Can this be done using Powershell?

Also, with the Code\Data folder. Do you mean in Visual Studio? I current do not have VS on the server and am not sure where you are referring to.

Thanks.
Mar 26, 2014 at 2:50 PM
Nevermind about the Company field, I added it to the User Profile (under People and Groups/ List Settings).

Now I just need to tie this to the FBA piece for when I create a new user, edit user (and display users) from the FBA Management Console. I'm still a bit lost, I can add those fields in the appropriate pages, but not sure they will Update in the SharePoint List/FBA list. Will let you know if I get Errors. Still not sure where to look for the Code/Data folder, are you referencing Visual Studio?
Coordinator
Mar 26, 2014 at 4:34 PM
Yeah, this is all in Visual Studio - you can't add the field just by editing the front end files. You need to edit the code. I was wondering why you couldn't find the data source if you were searching the code for 'email'. Code can be downloaded here:

https://sharepoint2010fba.codeplex.com/releases/view/91874
Jan 28, 2015 at 3:32 PM
Hello Ccoulson,

This webpart is being used by a very important client that I'm working for. Thye have asked to add 3 additional fields which I have managed to do. However, I now would like these fields to be included in the New User (FBAUserview.cs) and possible the Membership ReviewList.

I have tried but fail to up date the SharePoint User Info List....Could you provide me with any useful detail/code in which to do this?

We are currently using the SharePoint 2010 version of the code....Any additional information you may need, please let me know.
Coordinator
Jan 28, 2015 at 9:45 PM
There's some code here that shows you how to update custom fields on the sharepoint user info list:

http://sharepoint2010fba.codeplex.com/discussions/350006
Jan 28, 2015 at 10:08 PM
Thank you ever so much ccolson...I will definitely give this a go and let you know how I get on.