Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello All,
I currently have a section on a website called "projects" the user can create under this "project" as many as they want.
Is there a way forme to add a number for, or call the number of each project item.
I just want it to go 1,2,3,4 for each project.
So the user will have:
Project 1 : Number 1
Project 2 : Number 2
This is so that when i do a foreach inside my page I can set the CSS classes to accordian-@projectnumber and they will therefore be unique.
I dont want to use the ID if possible.
Kind regards,
James.
Solved it.
Just did:
int number = 1;
@foreach(){
my html + css then @number
number = ++number;
}
Sorted.
Thanks anyways guys.
Hi James,
Super you solve it :-),
Just want to say that another way that you could solve it is by this:
@foreach (var item in projectItems){ <h1>@item.Position() @item.Title</h1>}
I have just made a dummy foreach loop. Then it will print the position that it has in the Umbraco backoffice.
Maybe you can use it for future time.
/Dennis
Great ! Much simpler!
Thanks Dennis.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Generating a number for each child
Hello All,
I currently have a section on a website called "projects" the user can create under this "project" as many as they want.
Is there a way forme to add a number for, or call the number of each project item.
I just want it to go 1,2,3,4 for each project.
So the user will have:
Project 1 : Number 1
Project 2 : Number 2
This is so that when i do a foreach inside my page I can set the CSS classes to accordian-@projectnumber and they will therefore be unique.
I dont want to use the ID if possible.
Kind regards,
James.
Solved it.
Just did:
int number = 1;
@foreach(){
my html + css then @number
number = ++number;
}
Sorted.
Thanks anyways guys.
Hi James,
Super you solve it :-),
Just want to say that another way that you could solve it is by this:
I have just made a dummy foreach loop. Then it will print the position that it has in the Umbraco backoffice.
Maybe you can use it for future time.
/Dennis
Great ! Much simpler!
Thanks Dennis.
is working on a reply...