سؤال

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