LinkButton in ListView in UpdatePanel causes full postback
The ClientIDMode setting in ASP.NET 4 lets you specify how ASP.NET generates the id attribute for HTML elements.
In previous versions of ASP.NET (i.e. pre 4), the default behavior was equivalent to the AutoID setting of ClientIDMode. However, the default setting is now Predictable.
AutoId is required for this because of the way the script manager expects the HTML controls to be generated in previous versions of .NET.
I resolved this problem by setting: ClientIDMode="AutoID"
on the page directive of the applicable page like so:
<%@ Page Title="" ClientIDMode="AutoID" Language="C#"%>
This is working fine.
Try adding CommandName
, CommandArgument
attributes and the OnCommand
event handler to your linkbutton like this:
<asp:LinkButton CommandName='test' CommandArgument='<%# Eval("Title") %>' ID="lnkAddTarget" runat="server" OnCommand="LinkButtonCommandEventHandler" />
Or - adding OnItemCommand
handler to the whole ListView.