samedi 26 août 2023

Add attribute to checkbox so it can fire button click event

I have a button on my page which is a trigger for an update panel. The page does not refresh and all the variables on the page (sender) go into the btncalcsave_click event just fine. Instead of having to check a checkbox and click the button that is wired to the click event, I want to be able to just click the checkbox and btncalcsave_click will fire as when I click the button. How is this achieved?

I tried to add a trigger to the update template (cbbiweekly) which is the id of the checkbox but this doesn't work. Does the checkbox need to have an Onclick attribute added to it in order for this to work? I am unclear how to get this working.

<asp:CheckBox ID="cbbiweekly" runat="server" Text="Bi-Weekly Pmt Schedule" Font-Size="x-Small"  OnClientClick="btncalcsave_Click" />

<asp:UpdatePanel ID="udppmtschedule" runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btncalcsave" />
            <asp:AsyncPostBackTrigger ControlID="cbbiweekly" />
        </Triggers>
        <ContentTemplate>
            <table width="450px">



Aucun commentaire:

Enregistrer un commentaire