Copied to clipboard

Flag this post as spam?

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


  • BJ Patel 80 posts 206 karma points
    Aug 29, 2015 @ 04:42
    BJ Patel
    0

    Split giving error in Umbraco razor in multilingual site in umbrac 7

    I am having following node structure

    _Parent Site (Main site)

    • EN (English Site)

      • Node 1
      • Node 2
      • Node 3
    • CY (wales site)

      • Node 1
      • Node 2
      • Node 3
    • ES (spanish site)
      • Node 1
      • Node 2
      • Node 3

    I have copy all node of EN to other two site. (So all the contain of all node are same )

    I have use "Multinode Treepicker" as CSection for selecting node as shown in following code.

    < umbraco:Macro runat="server" Language="razor">
            @{  
                if(@Model.CSection != null)
                {
                string[] nodeIds = @Model.CSection.Split(',');
    

    The above code workings fine when rending EN site. but gives error while rendering CY and ES site. (As all site are having same value)

    I found that Following line gives error. for (CY and ES site)

    @Model.CSection.Split(',');
    

    Am I missing any thing ? ,I am not able to make it out at all I am using umbraco 7.2.6

  • Marc Goodson 2141 posts 14324 karma points MVP 8x c-trib
    Aug 30, 2015 @ 00:44
    Marc Goodson
    0

    Hi BJ

    I'd write out the value of @Model.CSection before 'doing the split' to see what it contains...

    When you copied the EN site, the CSection Multinode TreePicker would have contained a comma delimited string of the picked node Ids, perhaps for Node 1, Node 2, Node 3

    But the copied versions of the site would have created new Node Id's for Node 1, Node 2 and Node 3, underneath CY and ES - however the value of the Multinode Treepicker CSection wouldn't automatically update with these new node Id values.

    What you might need to do, is re-pick the nodes underneath each new language and republish, to reflect the updated ids...

    ... but writing out what the value contains before the split will give a good clue as to the cause of the error.

  • BJ Patel 80 posts 206 karma points
    Sep 02, 2015 @ 06:09
    BJ Patel
    0

    Yes, I have try to print out the value of node ID before split and it was with comma (some thing like 1802,1803) , And I have also try removed all the code after Split(',') but it was giving error.

    It, Gives error when I select 2 node Item , but when I select 3 node then it start working !! – BJ Patel 19 hours ag

Please Sign in or register to post replies

Write your reply to:

Draft