Above code threw this exception
'CMS.DataEngine.InfoDataSet<CMS.DocumentEngine.TreeNode>' does not contain a definition for 'Select' and no extension method 'Select' accepting a first argument of type 'CMS.DataEngine.InfoDataSet<CMS.DocumentEngine.TreeNode>' could be found (are you missing a using directive or an assembly reference?
But below alteration worked for me .
var pageIds = DocumentHelper.GetDocuments().Path("/folder path/%")
.Columns("DocumentID");
foreach (var document in pageIds)
{
Response.Write(HTMLHelper.HTMLEncode(document.DocumentID.ToString()) + "<br />");
}
Thanks