Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How to disable/enable the TargetControlID of ModalPopupExtender by clicking a button

$
0
0

Hello all,

I have a linkbutton that opens a modalpopupextender. User will be able to enter an amount and click submit which will close the modalpopup and update the linkbutton text to that of the input amount, eg: 20.50 KG (codes not shown here to avoid confusion).

The user will have the ability to clear their input amount by clicking on the clear button.

There is another button called the done button beside the clear button. As there will be many rows in the table, the purpose of this done button is to indicate to the user that the particular row has been completed. By clicking the done button, it will disable the clear button as well as the linkbutton which opens up the modalpopupextender. By clicking on the done button again, it should enable both the clear and linkbutton again.

As of now, I can successfully disable the clear button but I can't seem to disable the linkbutton. I thought of changing the TargetControlID to "btnCancel" since I already disabled the clear button. However, this is not working and I do not know if it is the correct approach.

I researched on disabling/changing the targetcontrolid but most points to prevent double-clicking which is not exactly what I need.

(Ps: It will be great if someone can also give me some advice on how to show a clear indication that the particular row is completed and revert the changes upon clicking done again. If it is not appropriate to ask this question here then its okay :)

<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
                                        BackgroundCssClass="modalBackground"
                                        PopupControlID="pnModelPopup"
                                        TargetControlID="lnkbtnSignin"
                                        BehaviorID="modal"
                                        CancelControlID="btnCancel"></asp:ModalPopupExtender><tr><td>Something 1</td><td><asp:label id="qty" runat="server" text="87.984"></asp:label></td><td><asp:LinkButton ID="lnkbtnSignin" runat="server" Text="&#60Enter an amount>"></asp:LinkButton></td><td><asp:Button ID="Clear" runat="server" Text="&#x2717;" BorderStyle="Inset" BorderColor="Black" BackColor="LightPink" CssClass="icon-arrow-left" OnClick ="clearAmount"></asp:Button>&nbsp&nbsp <asp:Button ID="Done" runat="server" Text="&#x2713;" BorderStyle="Inset" BorderColor="Black" BackColor="PaleGreen" CssClass="icon-arrow-right" OnClick="productFinish"></asp:Button></td></tr></tr>



//codebehind

    Protected Sub productFinish(ByVal sender As Object, ByVal e As EventArgs)

        Clear.Enabled = False
        ModalPopupExtender1.TargetControlID = "btnCancel"

    End Sub


    Protected Sub clearAmount(ByVal sender As Object, ByVal e As EventArgs)

        lnkbtnSignin.Text = "&#60Enter an amount>"
        lnkbtnSignin.ForeColor = Drawing.Color.CornflowerBlue
        inputTotalWeight.Text = ""

    End Sub

Thank you!


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>