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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Trying to figure out how to do this...Trying to figure out how to do this...
Previous
 
Next
New Post
4/7/2007 1:34 AM
 

I'm just learning how to use VS2005 for DNN modules...  There are two things that I've been scratching my head about for over a week now, and I am thinking they are relatively simple things to do, but I'm still stuck... 

1.  When creating a new item to insert into a table, I want one of the options to be a list of items from another table.  When writing .asp pages, I would simply throw a query into the page to input contents from that table into a listbox.  I cannot figure out how to do that in DNN though.

2.  Similar to that previous problem, I want another option (when inserting) to display a list of members of a security role to choose from.  I'm not entirely sure this is possible, but it seems like it should be.

Does anyone have a quick way to show me how to do this? 

 

 
New Post
4/7/2007 10:34 PM
 

1 - What can you not do here? You can write a query to handle getting results from this table or you can reference the module which the table came from and use its DAL to access its content.

2 - There is a built in method in the abstract Roles provider which can do this in Security.Roles.RoleController.


Chris Paterra

Get direct answers to your questions in the Community Exchange.
 
New Post
4/7/2007 11:09 PM
 

Regarding #2, here's a section of code where I obtain all uses being in one or more roles to which a custom permission has been assigned, rejecting any duplicates, removing from the list those users already appearing in a GridView of assigned users (in this case moderators), and then bind the remaining users to a drop down list. Note particularly the use of the DotNetNuke.Security.Roles.RoleController.GetUsersByRoleName method:

Private Sub FillAvailableModeratorsDDL()
            Dim arrAvailable As New ArrayList
            Dim arrAssigned As New ArrayList
            Dim mpc As New DotNetNuke.Security.Permissions.ModulePermissionController
            Dim rc As New DotNetNuke.Security.Roles.RoleController
            Dim mp As DotNetNuke.Security.Permissions.ModulePermissionInfo
            For Each mp In mpc.GetModulePermissionsCollectionByModuleID(ModuleId, TabId)
                If mp.PermissionCode = Permission.Code And mp.PermissionKey = Permission.ModerateKey Then
                    Dim RoleName As String = mp.RoleName
                    For Each ui As Entities.Users.UserInfo In rc.GetUsersByRoleName(PortalId, RoleName)
                        Dim li As New ListItem(ui.DisplayName, ui.UserID)
                        If Not arrAvailable.Contains(li) Then arrAvailable.Add(li)
                    Next
                End If
            Next
            Dim i As Integer = arrAvailable.Count - 1
            If gvModerators.DataKeys.Count > 0 Then
                Do While i >= 0
                    Dim li As ListItem = CType(arrAvailable.Item(i), ListItem)
                    Dim j As Integer = 0
                    Do While j < gvModerators.DataKeys.Count
                        Dim dk As DataKey = gvModerators.DataKeys(j)
                        If li.Value = dk.Value.ToString Then
                            arrAvailable.Remove(li)
                            Exit Do
                        End If
                        j += 1
                    Loop
                    i -= 1
                Loop
            End If
            With ddlAvailableModerators
                .DataSource = arrAvailable
                .DataBind()
                .Items.Insert(0, New ListItem(Localize("Select_New_Moderator"), 0))
            End With
            cmdAddModerator.Enabled = arrAvailable.Count > 0
        End Sub

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
4/8/2007 10:32 PM
 

Thanks!  That little code snippet answered a lot of my questions on how to create a list, how to populate it, etc...

Now I need to figure out how to integrate that into the whole program...  For example, most of the code examples I've looked at use the standard FormView function.  I haven't quite figured out how to insert something outside of the datasource into that tool.  Perhaps I'm going about it the wrong way?  Is it better to use a tool like the FormView, or write my own interface? 

Sorry about all the questions, it's been years since I did any serious programming, and this VS2005 is a bit more complex than I remember (I used to teach ANSI C). 

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Trying to figure out how to do this...Trying to figure out how to do this...


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