Created
March 4, 2014 16:26
-
-
Save ajtroxell/9349781 to your computer and use it in GitHub Desktop.
RazorScript for "x" amount of items from Form and List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using System.Data; | |
@using DotNetNuke.Entities.Modules; | |
@using DotNetNuke.Entities.Portals; | |
@using DotNetNuke.Modules.UserDefinedTable; | |
@using DotNetNuke.Entities.Users; | |
@{ | |
var mc = new ModuleController(); | |
var tc = new DotNetNuke.Entities.Tabs.TabController(); | |
int portalId = PortalController.GetCurrentPortalSettings().PortalId; | |
var flModule = mc.GetModuleByDefinition(portalId, "Form and List"); | |
int moduleId = -1; | |
int tabId = -1; | |
// form and list module name | |
var tab = tc.GetTabByName("News", portalId); | |
if (tab != null) { | |
tabId = tab.TabID; | |
} | |
// form and list module ID | |
if (flModule != null) { | |
moduleId = 968; | |
} | |
var ds = (new UserDefinedTableController(moduleId, tabId, new UserInfo())).GetDataSet(true); | |
int i = 0; | |
} | |
<ul> | |
@foreach (DataRow row in ds.Tables["Data"].Rows) | |
{ | |
if (i<3) | |
{ | |
<li> | |
<a href='/news#@row["UserDefinedRowId"]' title='@row["Title"]'>@row["Title"]</a> | |
</li> | |
i++; | |
} | |
} | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment