in the aspx file:

<asp:LinkButton ID="lnkbutton1" runat="server" Text="foo bar" OnClick="lnkbutton1_Click"></asp:LinkButton>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
some control...
</ContentTemplate>
   <Triggers>
     <asp:AsyncPostBackTrigger ControlID="lnkbutton1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>

in the code behind:

protected void lnkbutton1_Click(object sender, EventArgs e)
{
    lnkbutton1.CssClass = "activeAnchor";
}

Css class is not changing unless I remove the link button from the trigger(and have a full page post back)

Any help?

有帮助吗?

解决方案

Your linkbutton is outside the update panel.. it won;t update... its not supposed to.. Move it inside your update panel.

Your update panel is not mean to house the button that should update the controls, its actually meant to house the controls and the button.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top