Why not just use the api? Node n = new Node(1234) where you replace 1234 with node id of your home page. Then do foreach(n.Children) then in the loop n.GetProperties and loop through those.
In the grand scheme of things what exactly are trying to build? May help in determining if this is the best way forward.
What version of umbraco are you using? If later than 4.5.2 then use examine. Do a search on here on how to setup examine , there are videos on umbracotv as well. So you would create an examine index for nodetypealias car with all the properties you require. Searching / sorting etc will be lightening fast.
Hi Anton, (noticed your other forum posts on the same topic)
Once you have a table with all the data in a "pivoted" view (e.g. properties names/aliases for columns) ... what will you do with it? (e.g. CSV export)
I guess the point that Ismail and I are trying to get at is, to do this purely in T-SQL will be a headache. Using the API and/or Examine/Lucene to query the data and present it in an appropriate format would be much easier.
I want to do table by jqGrid, its working with database, I add SelectCommand to jqGrid and it sorting table in client side by javascript. Now I dont know, what I must do( For example http://www.trirand.net/demoaspnet.aspx. How I can realise it by Umbraco? Give me advise please.
On the jqGrid documentation pages, there is information about populating from an XML and DataTable sources. It is looking like you would need to write some custom code to populate the data-source.
A quick snippet would be like this...
// create the table schema
var table = new System.Data.DataTable();
table.Columns.Add("Id", typeof(int));
table.Columns.Add("Model", typeof(string));
table.Columns.Add("Year", typeof(string));
table.Columns.Add("Fuel", typeof(string));
table.Columns.Add("Volume", typeof(string));
// query the nodes that you want to get (using uComponents/uQuery)
var nodes = uComponents.Core.uQuery.GetNodesByXPath("descendant::DocTypeAlias");
foreach (var node in nodes)
{
// create new row
var newRow = table.NewRow();
// populate the row
newRow[0] = node.Id;
newRow[1] = node.GetProperty("model").Value;
newRow[2] = node.GetProperty("year").Value;
newRow[3] = node.GetProperty("fuel").Value;
newRow[4] = node.GetProperty("volume").Value;
// add the row to the table
table.Rows.Add(newRow);
}
// bind to the jqGrid
JQGrid1.DataSource = table;
JQGrid1.DataBind();
Note that I am using uComponents/uQuery to get the nodes of a specific doc-type alias. You could do this using the Umbraco API, but it involves more code.
Also this code is untested - wrote it completely off the top of my head.
How get all nodes from database?
I see table cmsPropertyData, How I can get all information from this table?
Anton,
What exactly are you trying to do? You want all the nodes or you want all the properties for a given node?
Regards
Ismail
Ismail,
I want all the nodes with all the properties for a each node
Anton,
Why not just use the api? Node n = new Node(1234) where you replace 1234 with node id of your home page. Then do foreach(n.Children) then in the loop n.GetProperties and loop through those.
In the grand scheme of things what exactly are trying to build? May help in determining if this is the best way forward.
Regards
Ismail
I want build table with all nodes. I have node car, this node has properies(model, year, fuel, volume, etc)
this is columns of this table
ID MODEL YEAR FUEL VOLUME
What the best way to do it? and then I want to have sorting for each column.
Anton,
What version of umbraco are you using? If later than 4.5.2 then use examine. Do a search on here on how to setup examine , there are videos on umbracotv as well. So you would create an examine index for nodetypealias car with all the properties you require. Searching / sorting etc will be lightening fast.
Regards
Ismail
Hi Anton, (noticed your other forum posts on the same topic)
Once you have a table with all the data in a "pivoted" view (e.g. properties names/aliases for columns) ... what will you do with it? (e.g. CSV export)
I guess the point that Ismail and I are trying to get at is, to do this purely in T-SQL will be a headache. Using the API and/or Examine/Lucene to query the data and present it in an appropriate format would be much easier.
Cheers, Lee.
I want to do table by jqGrid, its working with database, I add SelectCommand to jqGrid and it sorting table in client side by javascript. Now I dont know, what I must do( For example http://www.trirand.net/demoaspnet.aspx. How I can realise it by Umbraco? Give me advise please.
Hi Anton,
On the jqGrid documentation pages, there is information about populating from an XML and DataTable sources. It is looking like you would need to write some custom code to populate the data-source.
A quick snippet would be like this...
Note that I am using uComponents/uQuery to get the nodes of a specific doc-type alias. You could do this using the Umbraco API, but it involves more code.
Also this code is untested - wrote it completely off the top of my head.
Enjoy!
Cheers, Lee.
is working on a reply...