11.21.2008
Register     Login      
 
DotNetNuke Platinum Benefactor

We're happy to show our support for the DotNetNuke platform and community by contributing back to the project at the highest "Platinum" level.

XMod Form & Template Exchange Highlights
Here's a few of the latest additions to the XMod Form & Template Exchange. The Exchange contains snippets, samples, and solutions. It's free and open to all XMod users. We encourage you to use the samples and submit your own.

Visit the Exchange
Contribute to the Exchange

Mashups for XMOD
by Ray Chance
Java Enabled form with email
by Tony Smith
YouTube Video Include
by Patrick Cummings
BrightCove Player using the BrightCove ID ( Flash Player)
by Craig Porter
Kill the 'Edit Item' title
by Eric Mourant
Fading News Ticker
by Kelly Ford
GymnasticsMedia Store
by GymnasticsMedia
Parent Child Relationship For Categories (Select1)
by Ben Bahrenburg
Link Exchange
by Ben Bahrenburg
Fast and Easy News Scroller
by Sean Moran
Powered By XMod
DNNDev.com Forums
Subject: Update DetailsView to use XMod Managers
Prev Next
You are not authorized to post a reply.

Author Messages
neilxUser is Offline
XMod Varsity
XMod Varsity
Posts: 49




7/19/2008 5:09 AM  
I am happy to convert this module to use the new XMod Manager system if someone is able to give me a clue on what the new code should look like.

I have found the statement:
xmi = xmc.GetXMod(_XModId, Me.PortalId, _FormId)
which is the problem in that I think it uses old XMod code that is unaware of the Managers.

All I need - I am guessing - is the replacement code from XMod 5.1 to get data and display it in the template.

Are you able to help?
neilxUser is Offline
XMod Varsity
XMod Varsity
Posts: 49




7/20/2008 12:43 PM  
OK. I have hacked DetailView.ascx.vb to use a custom XMod Manager if the form says so.

This is my first attempt but it appears to work very well in that I can swap between default and custom managers on a form and the DetailsView module gets the data from the right place. I can use this as it is in current projects, but I am sure someone with intimate knowledge (or more than mine) of the XMod and XMod Manager source code could suggest some good refactorings. Please do.

Here is the source code to patch into the CreateDetailsView() method for those of you who would like to try it. It replaces the xmi = xmc.GetXMod(_XModId, Me.PortalId, _FormId) line, wrapping it in an if then else:

If objFormInf.ManagerId < 1 Then
xmi = xmc.GetXMod(_XModId, Me.PortalId, _FormId)
Else

Dim objSqlDataProvider As New SqlDataProvider
Dim objManager = objSqlDataProvider.GetManager(Me.PortalId, objFormInf.ManagerId)
Dim objDisplayManagerProvider As _
New DisplayManagerProvider(objManager.Tables(0).Rows(0)("Assembly"), _
objManager.Tables(0).Rows(0)("DisplayManager"))
Dim objXModManager = objDisplayManagerProvider.DisplayManager
Dim ds As New DataSet
Dim dt As DataTable
Dim dr As DataRow
objXModManager.Module = Me
ds = objXModManager.GetItem(_XModId)
dt = ds.Tables(0)
dr = dt.Rows(0)
xmi = objXModManager.GetXModInfo(dr)
End If
If xmi Is Nothing Then
' Unable to find record with _XModId
lblNoItemsFoundMessage.Visible = True
lblNoItemsFoundMessage.Text = _NoItemsFoundMsg
Else
Dim objInstData As New XMod.InstanceData(xmi.InstanceData, _XModId)
With objInstData
.AddUser = xmi.AddUser
.Approved = xmi.Approved
.DateAdded = xmi.DateAdded
.DateModified = xmi.DateModified
.DisplayDate = xmi.DisplayDate
.ExpiryDate = xmi.ExpiryDate
.UpdateUser = xmi.UpdateUser
.XModId = xmi.XModId
End With

If you can spot any fatal flaws, *please* let me know.
neilxUser is Offline
XMod Varsity
XMod Varsity
Posts: 49




7/20/2008 12:45 PM  
Too many statements pasted. You just need to the end if:

If objFormInf.ManagerId < 1 Then
xmi = xmc.GetXMod(_XModId, Me.PortalId, _FormId)
Else

Dim objSqlDataProvider As New SqlDataProvider
Dim objManager = objSqlDataProvider.GetManager(Me.PortalId, objFormInf.ManagerId)
Dim objDisplayManagerProvider As _
New DisplayManagerProvider(objManager.Tables(0).Rows(0)("Assembly"), _
objManager.Tables(0).Rows(0)("DisplayManager"))
Dim objXModManager = objDisplayManagerProvider.DisplayManager
Dim ds As New DataSet
Dim dt As DataTable
Dim dr As DataRow
objXModManager.Module = Me
ds = objXModManager.GetItem(_XModId)
dt = ds.Tables(0)
dr = dt.Rows(0)
xmi = objXModManager.GetXModInfo(dr)
End If
You are not authorized to post a reply.
Forums > Community Projects > XMod Detail View > Update DetailsView to use XMod Managers



ActiveForums 3.7
       Terms Of Use      Privacy Statement      © 2004-2008 Kelly Ford