Page 1 of 1

Manage Users - search

Posted: Thu Oct 22, 2009 9:03 am
by kastnerd
On the manager Users page, The search fields are very picky, If the user name is Peter, pete wont work. If the company is Black Water, Black wont find them.

Any way to change this?

Re: Manage Users - search

Posted: Thu Oct 22, 2009 10:18 am
by AbleMods
Use a wildcard asterisk after the Pete like "Pete*" to find them.

Re: Manage Users - search

Posted: Fri Oct 23, 2009 7:56 am
by kastnerd
Can I add company name to this display list on the search page?

Re: Manage Users - search

Posted: Fri Oct 23, 2009 8:22 am
by mazhar
Yep its simple to add company name to list. Just edit the Website/admin/people/default.aspx and locate following code block

Code: Select all

<asp:TemplateField HeaderText="Name" SortExpression="A.LastName">
                        <HeaderStyle horizontalalign="Left" />
                        <ItemStyle horizontalalign="Left" />
                        <ItemTemplate>
                            <asp:Label ID="FullNameLabel" runat="server" Text='<%#GetFullName(Container.DataItem)%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
and replace it with this one

Code: Select all

<asp:TemplateField HeaderText="Name" SortExpression="A.LastName">
                        <HeaderStyle horizontalalign="Left" />
                        <ItemStyle horizontalalign="Left" />
                        <ItemTemplate>
                            <asp:Label ID="FullNameLabel" runat="server" Text='<%#GetFullName(Container.DataItem)%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Company" SortExpression="A.Company">
                        <HeaderStyle horizontalalign="Left" />
                        <ItemStyle horizontalalign="Left" />
                        <ItemTemplate>
                            <asp:Label ID="CompanyNameLabel" runat="server" Text='<%#GetCompanyName(Container.DataItem)%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
and finally add following method to its code file next to GetFullName method

Code: Select all

protected string GetCompanyName(object dataItem)
    {
        User user = (User)dataItem;
        Address address = user.PrimaryAddress;
        if (address != null)
        {
            if (!string.IsNullOrEmpty(address.Company))
                return address.Company;
        }
        return string.Empty;
    }

Re: Manage Users - search

Posted: Wed Oct 28, 2009 7:54 am
by kastnerd
Thanks I did it on both admin/orders/create/createorders1.asp and admin/people/users/default.asp worked good.

Re: Manage Users - search

Posted: Mon Nov 07, 2011 9:24 pm
by Irfan
Thanks Mazhar,

Very helpful solution.

Regards,
Irfan Kadri