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 have a page with a richeditor and I need to get at the property's HTML value instead of just text.
Node currentPage = Node.GetCurrent(); int loopCount = 0;
for (int nodeCount = currentPage.Children.Count-1; nodeCount > -1; nodeCount--) { loopCount += 1; Node page = currentPage.Children[nodeCount];
string day = page.CreateDate.ToString("dd"); string month = page.CreateDate.ToString("MMM"); string topic = page.GetProperty("blogTopic").Value; string comment = page.GetProperty("blogComment").Value; string author = page.GetProperty("blogName").Value;
AddDataToTable(day, month, topic, comment, author, dtAuction);
if (loopCount == 50) break;
}
This just gets me the text and not the HTML inside.
Any help would be appreciated.
Please, any help with this would be appreciated!!!
Hi Craig,
I assume you get the encoded HTML as text? If so try HttpServerUtility.HtmlDecode. Example can be found on the MSDN site
Cheers,
Richard
Hi Richard,
Thanks for the reply. The problem I'm having is
page.GetProperty("blogComment").Value;
blogComment has carriage returns in the text editor but the above line just returns the text regardless of carriage returns. This result in one big piece of text?
Craig
You can use umbraco.library.ReplaceLineBreaks(page.GetProperty("blogComment").Value) to replace the carriage returns with <br/> tags
Hi Tom,
Thanks for the help......I've been acting a little like a fool with this one. Just taken a fresh look at things and
comment = comment.Replace(
"\n","<br />");
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get HTML from Property using Umbraco
I have a page with a richeditor and I need to get at the property's HTML value instead of just text.
Node currentPage = Node.GetCurrent();
int loopCount = 0;
for (int nodeCount = currentPage.Children.Count-1; nodeCount > -1; nodeCount--)
{
loopCount += 1;
Node page = currentPage.Children[nodeCount];
string day = page.CreateDate.ToString("dd");
string month = page.CreateDate.ToString("MMM");
string topic = page.GetProperty("blogTopic").Value;
string comment = page.GetProperty("blogComment").Value;
string author = page.GetProperty("blogName").Value;
AddDataToTable(day, month, topic, comment, author, dtAuction);
if (loopCount == 50) break;
}
This just gets me the text and not the HTML inside.
Any help would be appreciated.
Please, any help with this would be appreciated!!!
Hi Craig,
I assume you get the encoded HTML as text? If so try HttpServerUtility.HtmlDecode. Example can be found on the MSDN site
Cheers,
Richard
Hi Richard,
Thanks for the reply. The problem I'm having is
page.GetProperty("blogComment").Value;
blogComment has carriage returns in the text editor but the above line just returns the text regardless of carriage returns. This result in one big piece of text?
Craig
You can use umbraco.library.ReplaceLineBreaks(page.GetProperty("blogComment").Value) to replace the carriage returns with <br/> tags
Hi Tom,
Thanks for the help......I've been acting a little like a fool with this one. Just taken a fresh look at things and
comment = comment.Replace(
"\n","<br />");
Worked
Thanks for the help tom.
Craig
is working on a reply...