0

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)

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

BJ Patel
  • 6,148
  • 11
  • 47
  • 81

1 Answers1

0

It is a bit hard to say what is wrong, but since the Split(',') doesn't really do much that could give you errors, I'm guessing the error happens in some of the code after the split?

Have you ensured that the value of @Model.CSection is indeed a comma separated string in all instances of your site? (try printing the value in your template)

Another thing that could be wrong if it is not the split failing: You should know that copying a site like this does not mean you rewrite internal references to nodes within the copied tree. For instance:

  • Site A (id 1)
    • Page X (id 2)
    • Page Y (id 3)

On Page Y (3) you have a reference to Page X (2). Now you copy this site to Site B:

  • Site B (id 4)
    • Page X (id 5)
    • Page Y (id 6)

The reference on the new Page Y (id 6) will however still point to the old Page X (id 2) and has to be manually corrected if you need it to be otherwise.

If you have some kind of limitation or rely on a reference to be within the same parent site as the one currently being rendered, this could be what is causing you issues. Your Wales/Spain templates might actually be trying to use a page from a different parent site due to the items chosen in that content picker still referencing the nodes in the english site.

Let me know if this helps - otherwise I need a hint on what error you are getting!

Claus
  • 1,975
  • 18
  • 24
  • Thanks for your reply , sorry I miss out to write , but I am referring to other tree node ,so it's not the case , And 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. – BJ Patel Sep 01 '15 at 10:31
  • It seems very strange if you are completely sure that the value of Model.CSection is indeed a comma separated string, why the `Split(',')` would fail. There's really nothing special about this function as it just needs a string and as long as it gets that it will return at least that same string if it doesn't find any matches for the split character. Any chance you could share some more code or even a link to the page where this is happening? – Claus Sep 03 '15 at 06:14