I would suggest including in the settings control for the master view a drop down list allowing the admin user to select the particular details view module. Code to populate the drop down list could be as follows:
Dim dmc As New Entities.Modules.DesktopModuleController
Dim dm As Entities.Modules.DesktopModuleInfo = dmc.GetDesktopModuleByModuleName("WESNet_EPrayer")
Dim mc As New Entities.Modules.ModuleController
Dim myMods As ArrayList = mc.GetModulesByDefinition(PortalId, dm.FriendlyName)
Dim mi As Entities.Modules.ModuleInfo
Dim tc As New Entities.Tabs.TabController
ddlMods.Items.Clear()
ddlMods.Items.Add(New ListItem("Select Details View Module", ""))
For Each mi In myMods
Dim tabName As String = tc.GetTab(mi.TabID, PortalId, False).TabName
ddlMods.Items.Add(New ListItem(String.format("Module named '{0}' on page '{1}'", _
mi.ModuleName, tabName), String.format("{0}-{1}", mi.TabID, mi.ModuleID)))
Next
Alternatively, if you are certain that one and only one details view module would ever exist in the portal, the drop down list could be eliminated and the above code modified to use the first (and only) element from the myMods ArrayList. In either case, the TabID-ModuleID string would then be stored in the master module's settings (using for example a settings key of "detailsModule") to be later retrieved and used to build the URL (using one of the many forms of the NavigateUrl(...) method as follows (where teacherID is the details item ID):
Dim detailsModule As String = CType(ModuleSettings("detailsModule"), String)
Dim args As String() = detailsModule.Split("-"c)
Dim detailsURL As String = NavigateURL(Integer.Parse(args(0)), "", New String() {"mid=" & args(1), _
"teacher=" & teacherID.ToString})
Please note that I have not included any error or security checks in the above code which has not been tested in an actual application.