Reputation: 65
I am getting the "The Server tag not well formed error". Please see the below code:
<ul id="wizHeader">
<asp:Repeater ID="SideBarList" runat="server">
<ItemTemplate>
<li>
<asp:LinkButton runat="server" CssClass="<%# GetClassForWizardStep(Container.DataItem) %>" Font-Bold="true" ID="SideBarButton" OnClick="Step_Click" Text="<%# Eval("Name") %>" ToolTip="<%# Eval(ID) %>"></asp:LinkButton>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
Upvotes: 1
Views: 139
Reputation: 2387
Alternatively you can use a simple anchor tag and apply all bindings to it. And make it cause the same postback as your button was doing. Example:
<a onClick="javascript:__doPostBack('<%= SideBarButton.UniqueID %>')" class="<%# GetClassForWizardStep(Container.DataItem) %>"> <%# Eval("Name") %></a>
After doing this, you would have to hide the link button by settings its css display property none.
Long work around. :)
Upvotes: 0
Reputation: 63772
You can't use <%# inside of server controls' attribute.
So if you want to use a LinkButton inside of the Repeater, you have to bind the attributes in code-behind using the Repeater.ItemDataBound event.
Example from MSDN: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.itemdatabound(v=vs.110).aspx
Upvotes: 3