Server tag not well formed, ASP Repeater Datasource

I get a parser error with a message. The server tag is poorly formed for the next line.

<asp:Repeater runat="server" DataSource="<%# ((MultilistField)((Item)Container.DataItem).Fields["Tags"]).GetItems() %>"> <ItemTemplate> <sc:FieldRenderer ID="FieldRenderer1" runat="server" FieldName="Tag name" Item="<%# Container.DataItem %>"/> </ItemTemplate> <SeparatorTemplate> / </SeparatorTemplate> </asp:Repeater> 

The syntax looks great, but I'm not sure if you can use the .Field ["tags"] element there.

I tried looking for it, but could not find a similar problem. I hope someone provides me some insight into why the parser complains about this line.

thanks

+4
source share
4 answers

What comes to my mind now is to use only one quotation mark instead:

 <asp:Repeater runat="server" DataSource='<%# ((MultilistField)((Item)Container.DataItem).Fields["Tags"]).GetItems() %>' > 
+12
source

You have double quotes in the attribute. This is confusing for the parser - it cannot determine where the attribute ends.

Wrap the attribute in single quotes to fix it:

 DataSource='<%# ((MultilistField)((Item)Container.DataItem).Fields["Tags"]).GetItems() %>' 
+3
source

try 'instead' it can work

else try binding from code for

 <asp:Repeater runat="server" DataSource='<%# ((MultilistField)((Item)Container.DataItem).Fields["Tags"]).GetItems() %>' > 
+1
source

Do you have a closing tag? i.e.

 </asp:Repeater> 

Otherwise, you are missing / at the end of the declaration of your tag.

 <asp:Repeater runat="server" DataSource="<%# ((MultilistField)((Item)Container.DataItem).Fields["Tags"]).GetItems() %>" /> 
0
source

All Articles