Copied to clipboard

Flag this post as spam?

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


  • dominik 711 posts 733 karma points
    Oct 17, 2012 @ 12:52
    dominik
    0

    Problems after changing from 4.7.0 to 4.7.2

    Hello,

    We are trying to switch from 4.7.0 to 4.7.2 and after changing all our existing razor scripts does not work any more. 

    As an example:

    <ul id="newsticker">
    @{
        var news = Model.NewsTickerItems;

                foreach(dynamic item in news)
                {
                 if(!string.IsNullOrEmpty(@item.Link))
                 {
                    <li>++++ <a href="@Model.NodeById(item.Link).NiceUrl">@item.Text</a> ++++</li>
                  } else {
                     <li>++++ @item.Text ++++</li>
                 }
                }
    }
    </ul>

     

    throws an error:

    Error loading Razor Script HomeNewsTicker.cshtml
    The best overloaded method match for 'string.IsNullOrEmpty(string)' has some invalid arguments


  • dominik 711 posts 733 karma points
    Oct 17, 2012 @ 12:53
    dominik
    0

    after changing if(!string.IsNullOrEmpty(@item.Link)) to if(!string.IsNullOrEmpty(@item.Link.ToString())) i am getting the following error:

    Error loading Razor Script HomeNewsTicker.cshtml
    Cannot instantiate a DynamicNode without an id

  • dominik 711 posts 733 karma points
    Oct 17, 2012 @ 15:23
    dominik
    0

    Is there someone who can help me by rewriting the code so it will also work under 4.7.2?

    The XML looks like:

    <newsTickerItems>

            <data>

              <item id="1">

                <Text propertyid="1">Test1</Text>

                <Link propertyid="2" />

              </item>

              <item id="2">

                <Text propertyid="1">Test2</Text>

                <Link propertyid="2" />

              </item>

              <item id="3">

                <Text propertyid="1">Test3</Text>

                <Link propertyid="2">1439</Link>

              </item>

            </data>

          </newsTickerItems>

  • dominik 711 posts 733 karma points
    Oct 17, 2012 @ 16:23
    dominik
    0

    i was able to solve it by using 

    @item.Link.InnerText instead of @item.Link and

    @item.Text.InnerText instead of @item.Text

    Can someone explain this? Why this has been changed from version 4.7.0 to 4.7.2

    Will this change also if I am upgrading to version 4.9?

  • dominik 711 posts 733 karma points
    Oct 18, 2012 @ 08:19
    dominik
    0

    Can somebody please help?

Please Sign in or register to post replies

Write your reply to:

Draft