ASP Declaration:
<asp:LinkButton ID="LinkButton1" runat="server" Text="edit item" onclick="'AddItem.aspx?catid=<%# Eval("CollectionID")%>'"></asp:LinkButton>
I get Error: The server tag is not well formed.
what the problem with LinkButton decloration? Thank you in advance.
I removed extraneous quotes around the attribute value for
OnClick
.However,
OnClick
expects a delegate, not a URL. Either use a hyperlink or switch to an event handler.This article shows how to pass an argument to an event handler from a link button. Instead of using
OnClick
, you can useOnCommand
and set theCommandArgument
property.In Markup
In Codebehind
I favor using a URL versus a command event handler whenever possible as it eliminates a comparatively expensive postback.