vendredi 15 novembre 2019

CheckBox does not fire CheckedChanged event when unchecking the checkbox Dynamically in ASP.Net

Here I am having a checkbox in this update panel.

<asp:UpdatePanel runat="server" ID="LVCheckBoxes">
    <ContentTemplate>
            <ul>
                <li>
                    <asp:CheckBox ID="New" Text="New" AutoPostBack="true" runat="server" OnCheckedChanged="checkBoxCheck" /></li>
            </ul>
    </ContentTemplate>
</<asp:UpdatePanel >

All I am Trying to do is uncheck it on click of linkbutton. Which is working fine.

<asp:LinkButton id="LbUnCheck" runat="server" OnClick="LbUnCheck" ToolTip="New">UnCheck</asp:LinkButton>

But Along with it I also want to fire the check changed Event Which is not firing

protected void LbUnCheck(object sender, EventArgs e)
{
        LinkButton lb = (LinkButton)sender;
        CheckBox cb = (CheckBox)LVCheckBoxes.FindControl(lb.ToolTip);
        cb.CheckedChanged += checkBoxCheck;
        cb.Checked = false;

}


protected void checkBoxCheck(object sender, EventArgs e)
{
   //Do something

}

I even Tried this using JQuery but it is not working quite as expected.

Help Appreciated..!!




Aucun commentaire:

Enregistrer un commentaire