Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I create a new .net control which will show content data in a DataGridView. Here is the code
umbraco.presentation.nodeFactory.Node node = new umbraco.presentation.nodeFactory.Node(1243);
umbraco.presentation.nodeFactory.Nodes childrenNodes = node.Children;
vessel.DataSource = childrenNodes;
vessel.DataBind();
Node node = new Node(1243);
Nodes childrenNodes = node.Children;
DataTable dt = new DataTable();
dt.Columns.Add("vesselName");
dt.Columns.Add("position");
foreach (Node tmp in node.Children)
{
DataRow row = dt.NewRow();
row["vesselName"] = tmp.GetProperty("vesselName").Value;
row["position"] = tmp.GetProperty("position").Value;
dt.Rows.Add(row);
}
You need to use the Document API as the Node API works against the XML cache not the database.
The Document API is part of the cms assembly, and you can basically swap Node for Document and I believe everything is the same (or almost the same).
If you have a look around the forum you'll find plenty of examples of creating/ editing content programmatically.
As @slace says, use the document api instead of the nodeFactory, and don't go directly into the db, that's asking for trouble..
Cheers,
/Dirk
This wiki page might also be helpfull if you want more info about nodes and documents: http://our.umbraco.org/wiki/reference/api-cheatsheet/difference-between-a-node-and-a-document.
Jeroen
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Save node property data
I create a new .net control which will show content data in a DataGridView. Here is the code
umbraco.presentation.nodeFactory.Node node = new umbraco.presentation.nodeFactory.Node(1243);
umbraco.presentation.nodeFactory.Nodes childrenNodes = node.Children;
vessel.DataSource = childrenNodes;
vessel.DataBind();
Node node = new Node(1243);
Nodes childrenNodes = node.Children;
DataTable dt = new DataTable();
dt.Columns.Add("vesselName");
dt.Columns.Add("position");
foreach (Node tmp in node.Children)
{
DataRow row = dt.NewRow();
row["vesselName"] = tmp.GetProperty("vesselName").Value;
row["position"] = tmp.GetProperty("position").Value;
dt.Rows.Add(row);
}
You need to use the Document API as the Node API works against the XML cache not the database.
The Document API is part of the cms assembly, and you can basically swap Node for Document and I believe everything is the same (or almost the same).
If you have a look around the forum you'll find plenty of examples of creating/ editing content programmatically.
As @slace says, use the document api instead of the nodeFactory, and don't go directly into the db, that's asking for trouble..
Cheers,
/Dirk
This wiki page might also be helpfull if you want more info about nodes and documents: http://our.umbraco.org/wiki/reference/api-cheatsheet/difference-between-a-node-and-a-document.
Jeroen
is working on a reply...