vijay's sample is perfect, but be aware of the fact that you should only use the document api if you're working in the backend (umbraco admin site). If you're on the frontend, you should use the nodeFactory.Node class (see my blog post on this)
when u want to retrive the Particular Node Contents
put below code in xslt file
<xsl:choose> <xsl:when test="count(Farmscape-FAQ/node[@nodeTypeAlias='Something2'])<=0"> <div id="NoComments"> There are no comments yet... be the first to make one ... </div> </xsl:when> <xsl:otherwise>
how to retrieve contents of specific selected node
Hi folks.,
how to retrieve contents of particular selected node
for example:
if i select "something2" in the below sample its content should be retrieved..
i am not using xslt here .is there any other way to do it?
Hi sam,
Can u give clear idea what u want to do to me.
if u want to read contents / document types inside the node u have to use following code
Document doc = new Document(NodeID));
txt_QText.Text = doc.getProperty("QuestionText").Value.ToString();
-----------------------------------------------------------------------------------------------------------------------------
If u want to get child nodes below Something2 below code is used to display Page1,Page2,Page3 in dropdown
private void Fill_DD_Category()
{
string st = string.Empty;
DataTable dt;
dt = new DataTable();
dt.Columns.Add(new DataColumn("nodeName", typeof(string)));
dt.Columns.Add(new DataColumn("nodeid", typeof(string)));
DataRow dr;
dr = dt.NewRow();
dr["nodeName"] = "Please select category";
dr["nodeid"] = "0";
dt.Rows.Add(dr);
Node CurrentNode = Node.GetCurrent();
Nodes nodes = CurrentNode.Children;
foreach (Node node in nodes)
{
if (node.NodeTypeAlias == "Something2")
{
dr = dt.NewRow();
dr["nodeName"] = node.Name;
dr["nodeid"] = node.Id;
dt.Rows.Add(dr);
st = st + "/" + node.Name;
}
}
Response.Write(dt);
DD_Category.DataTextField = "nodeName";
DD_Category.DataValueField = "nodeid";
DD_Category.DataSource = dt;
DD_Category.DataBind();
}
Hope this helps,
cheers
vijay.
to be precise i need to retreive content of particlar selected node alone and not its child content
thank you Vijay.
i got clue from your post
Sam,
vijay's sample is perfect, but be aware of the fact that you should only use the document api if you're working in the backend (umbraco admin site). If you're on the frontend, you should use the nodeFactory.Node class (see my blog post on this)
Cheers,
/Dirk
hi sam,
when u want to retrive the Particular Node Contents
put below code in xslt file
<xsl:choose>
<xsl:when test="count(Farmscape-FAQ/node[@nodeTypeAlias='Something2'])<=0">
<div id="NoComments">
There are no comments yet... be the first to make one ...
</div>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="Farmscape-FAQ/node[@nodeTypeAlias='Something2']">
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a> (<xsl:value-of select="count(node[@nodeTypeAlias='DocumentTypeAlias'])"/>)
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
cheers
vijay.
Thanks for your reply sam
cheers
vijay
is working on a reply...