using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.web;
using umbraco.cms.businesslogic.media;
using umbraco.presentation;
using umbraco.presentation.nodeFactory;
using System.Xml;
using System.Xml.Serialization;
using umbraco.cms.businesslogic;
using System.Collections;
public partial class xinwen : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
Document dcm = new Document(Convert.ToInt32(UmbracoContext.Current.PageId));
// umbraco.library.NiceUrl(yourId);
Guid g = new Guid("a74ea9e1-8e18-4d2a-8cf6-73c6206c5da6");新建的datatype的guid值 根据这个获取控件内容
umbraco.cms.businesslogic.datatype.DataTypeDefinition dn = umbraco.cms.businesslogic.datatype.DataTypeDefinition.GetByDataTypeId(g);
this.Label1.Text = this.Label1.Text + "</br>dn的值是:" + dn.Id;
this.Label1.Text = this.Label1.Text + "</br>dn的textg值是:" + dn.Text;
string count = umbraco.cms.businesslogic.datatype.PreValues.CountOfPreValues(dn.Id).ToString();
this.Label1.Text = this.Label1.Text + "</br>PreValues的count值是:" + count;
//根据id获取值
//为下拉框赋值 然后点击获取值 "";
drpListXs.Items.Insert(0, new ListItem("您要欣赏?", "您要欣赏?"));
SortedList list = umbraco.cms.businesslogic.datatype.PreValues.GetPreValues(dn.Id);
for (int i = 0; i < int.Parse(count); i++)
{
int Xs = i + 1;
umbraco.cms.businesslogic.datatype.PreValue pv = (list[i]) as umbraco.cms.businesslogic.datatype.PreValue;
this.Label1.Text = this.Label1.Text + "</br> pv.Value值是:" + pv.Value;
drpListXs.Items.Insert(Xs, new ListItem(pv.Value, pv.Value));
}
//获取目录下的所有目录
string value = "";
Document[] dc = Document.GetRootDocuments();//获取所有的节点
foreach (Document dd in dc)
{
if (dd.Text == "新闻")//content下面的节点名称
{
if (dd.HasChildren)
{
//获取第一篇的标题描述
for (int i = 0; i < 1; i++)
{
value += "标题:" + dd.Children[i].getProperty("xwbiaoti").Value;//标题 DocumentType的属性xwbiaoti
value += "</br>描述" + dd.Children[i].getProperty("xwjianjie").Value;//描述
}
//后面两条只显示标题
int Sx = 0;
if (dd.ChildCount > 3)
{
Sx = 3;
}
else
{
Sx = dd.ChildCount;
}
for (int i = 1; i < Sx; i++)
{
value += "</br></br>标题" + dd.Children[i].getProperty("xwbiaoti").Value;//标题
}
}
}
}
content.InnerHtml = value.ToString();
}
}
Media image; image = new Media(Convert.ToInt32(currentDocument.getProperty("AdvertTwoImage").Value)); return image.getProperty("umbracoFile").Value.ToString();