I am trying to create a 5 personalised quick links options for a user. I know that repeater items are generated from the datasource. These quick link fields by default have an add or delete link option. What should I do if datasource returns just 3 and I still want want to add the 2 extra controls.
Right now I created 5 controls statically, which I don't really like. Sorry I am really new to C#. Googled hard...maybe not hard enough...still googling right now. Thank you in advance for any suggestions or tips.
Here's an example
So if I understand well:
You retrieve 0-5 links from a datasource which you want to show. If links < 5 you want to show the others as blank with a '+' sign?
There are plenty of solutions for this. From your tags I'll assume you will be using ASP.NET so: In your view when you acces your data from Viewbag or Model I'll call it 'list'
@{
int i = 0; //Counting your items can also be done by length of list
}
<ul>
@foreach(var link in list)
{
<li>@link.Name <span class="delete">-</span></li>
i++;
}
@for(j=0;j<i;j++)
{
<li>__<span class="add">+</span></li>
}
</ul>