Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...UserSelector ControlUserSelector Control
Previous
 
Next
New Post
11/9/2010 3:59 PM
 
Is there any kind of a standard UserSelector control that can be added to modules? It's not too hard to write but seems a common enough need that there should be a common control for this.

I want Admins to be able to search for users by email. The control would return a list of matches. The user would then select one and the module would display the information for that user.

David O'Leary
Efficion Consulting
 
New Post
11/9/2010 4:27 PM
Accepted Answer 
By using the DnnGrid, I was able to create a very powerful solution for this in a matter of minutes. I added a new UserControl called UserSelector. In the ascx, I put the following:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="UserSelector.ascx.vb" Inherits="DotNetNuke.Controls.UserSelector" %>
<%@ Register TagPrefix="dnnWebControls" Namespace="DotNetNuke.Web.UI.WebControls" Assembly="DotNetNuke.Web" %>
<dnnWebControls:DnnGrid ID="grdPlayer" DataSourceID="dsUsers" runat="Server" Width="100%" AutoGenerateColumns="true" PageSize="4"
 AllowSorting="true" MasterTableView-AllowPaging="true" AllowFilteringByColumn="true" >
     <MasterTableView AllowSorting="true">
         <Columns>
            <dnnWebControls:DnnGridTemplateColumn AllowFiltering="false" HeaderText="Details" >
                <ItemTemplate>
                    <a href='<%# GetURL(DataBinder.Eval(Container.DataItem,"UserID")) %>'><%# "SELECT"%></a>
                </ItemTemplate>
            </dnnWebControls:DnnGridTemplateColumn>
        </Columns>
    </MasterTableView>
          
</dnnWebControls:DnnGrid>

<asp:SqlDataSource ID="dsUsers" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" runat="server"
 SelectCommand="Select UserID,Username,FirstName,LastName,Email,DisplayName from Users">
</asp:SqlDataSource>

In the code behind:

Namespace DotNetNuke.Controls
    Partial Class UserSelector
        Inherits DotNetNuke.Entities.Modules.PortalModuleBase

        Protected Function GetUrl(ByVal userid As String) As String
            Return NavigateURL(TabId, "", "userid=" & userid)
        End Function
    End Class
End Namespace


David O'Leary
Efficion Consulting
 
New Post
11/10/2010 6:00 AM
 
the only "user Selector" control atm is URLControl, which has an option of creating a link to the userID, but supports entering username only. I agree, a proper selection control (with portal settings including available search options) would be a great improvement.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
11/10/2010 4:55 PM
 
I should mention the above solution only works for DNN 5.5+. And should only be used by administrators.

David O'Leary
Efficion Consulting
 
New Post
11/10/2010 6:52 PM
 
Hi David, unfortunately this doesn't affect the list of available controls :S

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...UserSelector ControlUserSelector Control


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out