Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ronak Panchal 71 posts 230 karma points
    Feb 29, 2016 @ 12:36
    Ronak Panchal
    0

    Rich Text Editor value always return with <p></p> tag.

    Hello all,

    I install Umbraco version 7.4.1.

    I made one parent document type and set one template to it and allow this document type at root.

    I made one Child document type with rich text editor property and also set one template to it and allow this document type below parent.

    I made one content page of parent document type after that i create child pages.

    Now,I need child node of parent document type. so i write below code for it.

    var items = Umbraco.TypedContentAtRoot().Where("DocumentTypeAlias == \"parentDoctypeAlias\"").FirstOrDefault().Children;
    foreach (var item in items) 
        {
             var teststring= item.GetPropertyValue<string>("proprtyalias", true);
        }
    

    value of teststring is always return with <p>sample string</p> for my requirement i must use RTE.

    I tried to Edit tinyMceConfig.config file,i added one line of code into it as shown below,but it is not working.

    <config key="forced_root_block"></config>
    

    Any Help would be appreciated,

    Thanks,

    Ronak Panchal.

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 9x admin c-trib
    Feb 29, 2016 @ 12:47
    Alex Skrypnyk
    0

    Hi Ronak,

    You can render your data like that :

    @Umbraco.Field("fieldName", removeParagraphTags:true)

    Did you try to change it like in this post - http://scottsdevblog.com/2011/08/get-rid-of-those-pesky-p-tags-in-umbracos-tinymce-editor/

    Thanks

  • Ronak Panchal 71 posts 230 karma points
    Mar 01, 2016 @ 05:06
    Ronak Panchal
    0

    Hi alex,

    I need tried http://scottsdevblog.com/2011/08/get-rid-of-those-pesky-p-tags-in-umbracos-tinymce-editor/

    but its not working.

    can you please explain me how to use@Umbraco.Field("fieldName", removeParagraphTags:true) on another template.

    i use var teststring= item.GetPropertyValue<string>("proprtyalias", true); as you see in my question.

    Thanks

    Ronak

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 9x admin c-trib
    Mar 01, 2016 @ 13:34
    Alex Skrypnyk
    1

    Hi Ronak,

    If you want to get Umbraco.Field from current page you have to use @Umbraco.Field("fieldName", removeParagraphTags:true).

    If you want to get Umbraco.Field from items in foreach, try to use:

                var items = Umbraco.TypedContentAtRoot().Where("DocumentTypeAlias == \"parentDoctypeAlias\"").FirstOrDefault().Children;
                foreach (var item in items)
                {
                    var teststring = Umbraco.Field(item, "proprtyalias", removeParagraphTags: true);
                }
    

    Thanks

  • Manikandan 15 posts 96 karma points
    Mar 01, 2016 @ 06:44
    Manikandan
    1

    Try Like this

    @Html.Raw(Teststring)
    

    It will show the output without any tags

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies