This is a migrated thread and some comments may be shown as answers.

[Solved] Dynamical creation of panel bar - Content problem

1 Answer 42 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
hugues viens
Top achievements
Rank 1
hugues viens asked on 19 Aug 2011, 12:04 AM
Hi,

i m creating panelbars with foreach:
Html.Telerik().PanelBar()
      .Name("pnlFichePatient")
       .Items(bar =>
        {
           foreach (EVENEMENT ev in Model)
              {
                bar.Add()
               .Text(String.Format("{0} - {1} - {2}",ev.EVENEMENTTYPE.EVENEMENTTYPE1,ev.DATEVENEMENT,ev.MEDECINS.PRENOM+" "+ev.MEDECINS.NOM))
              .ImageUrl(string.Format("{0}/{1}.png", Url.Content("~/Content/iconsEvent"), ev.EVENEMENTTYPE.ICONE.ToString()))
              .ImageHtmlAttributes(new { height = "16px", width = "16px" })
              .Expanded(true)
              .Content(@<text>
                             Fake content :  @ev.DATEVENEMENT
                             </text>)
                             ;
               }
 
                  })
                  .Render();



Everything works except for the Content. All panelbars use the same Content (the first one) :/

It 's working if instead of using .Content() i use .LoadContentFrom() but I'm not quite please with that solution. Is there a way to achieve my goal using the .Content() property (server side) ?

Thanks.

1 Answer, 1 is accepted

Sort by
0
hugues viens
Top achievements
Rank 1
answered on 19 Aug 2011, 12:11 AM
Ha well, i found the solution in the forum (thanks goes to chris) :

.Content(String.Format("{0}",ev.DATEVENEMENT))

you can't use @<text></text> in this context.
Tags
PanelBar
Asked by
hugues viens
Top achievements
Rank 1
Answers by
hugues viens
Top achievements
Rank 1
Share this question
or