Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The server tag is not well formed, ASP Repeater Datasource

Tags:

asp.net

I've been getting parser error with message The server tag is not well formed for the following 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 fine, but one thing I'm not sure about is whether you can use the ".Field["tags"] element in there.

I've tried looking it up, but couldn't find a similar problem. I'm hoping someone provide me with some insight to why the parser is complaining about this line.

Thanks

like image 805
Jun Zheng Avatar asked Jun 14 '12 18:06

Jun Zheng


1 Answers

What comes into my mind right now is to use a single-quoted string instead:

<asp:Repeater runat="server" DataSource='<%# ((MultilistField)((Item)Container.DataItem).Fields["Tags"]).GetItems() %>' >
like image 173
StrubT Avatar answered Oct 26 '22 22:10

StrubT