Last active
December 25, 2015 18:29
-
-
Save bomortensen/7021105 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var content = ApplicationContext.Services.ContentService.GetById(1051); | |
var data = new GridRowCollection(); | |
string[] nodeIds = {"1051", "1052"}; | |
foreach (string companyNodeId in nodeIds) | |
{ | |
Node node = uQuery.GetNode(companyNodeId); | |
var row = new GridRow(); | |
var companyCell = new GridCell() { DataType = 1034, Alias = "nodePicker", Name = node.Name, Value = node.Id.ToString()}; | |
var permissionCell = new GridCell { DataType = -42, Alias = "permission", Name = "Permission", Value = "7" }; | |
row.Add(companyCell); | |
row.Add(permissionCell); | |
data.Add(row); | |
} | |
content.SetValue("datatypeGrid", data.ToString()); | |
ApplicationContext.Services.ContentService.SaveAndPublish(content); | |
// Umbraco XML: | |
<datatypeGrid> | |
<items> | |
<item id="0" sortOrder="1"> | |
<nodePicker nodeName="Installing modules" nodeType="1034">1051</nodePicker> | |
<permission nodeName="Permission" nodeType="-42">7</permission> | |
</item> | |
<item id="0" sortOrder="2"> | |
<nodePicker nodeName="Go further" nodeType="1034">1052</nodePicker> | |
<permission nodeName="Permission" nodeType="-42">7</permission> | |
</item> | |
</items> | |
</datatypeGrid> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment