Copied to clipboard

Flag this post as spam?

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


  • Johan 95 posts 264 karma points
    Dec 07, 2015 @ 08:12
    Johan
    0

    What datatype is RTE?

    I want to validate an RTE but I'm not quite sure what datatype it is.

    For example, if I want to validate a textstring I do it like this:

     <td data-title="Adress">
                                    @if (!string.IsNullOrEmpty(school.adress))
                                            {
                                            @school.adress
                                            }
                                            else
                                            {
                                            <text>&nbsp;</text>
                                            }
                                </td>
    

    But for an RTE, I can't use !string because it's not a string.

    How would the validation look like for RTE?

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Dec 07, 2015 @ 08:30
    Dave Woestenborghs
    100

    The RTE returns a IHtmlstring object.

    So you need to do this :

    <td data-title="Adress">
                                    @if (!string.IsNullOrEmpty(school.adress.ToString()))
                                            {
                                            @school.adress
                                            }
                                            else
                                            {
                                            <text>&nbsp;</text>
                                            }
                                </td>
    

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft