Enable (show) and Disable (hide) ConfirmButtonExtender

Discussion in 'ASP .Net' started by jason.richard@gmail.com, Jul 3, 2008.

  1. Guest

    Hi

    Does anyone know how to disable and enable ConfirmButtonExtender,
    using Javascript?

    I don't want the ConfirmButtonExtender to be enable until a change to
    a text box has been made.

    Here is the code I have so far

    ASP.NET Code


    <asp:UpdatePanelID="UpdatePanel3"runat="server">

    <contenttemplate>


    <asp:TextBoxID="tbPort"CssClass="medium_textbox"runat="server"MaxLength="250"/
    >





    <br/>

    <asp:ButtonID="btnBack"runat="server"Text="Back to Hail
    List"OnClick="btnBack_Click"CausesValidation="False"/>





    <ajaxToolkit:ConfirmButtonExtenderID="ConfirmButtonExtender2"runat="server"TargetControlID="btnBack"DisplayModalPopupID="ModalPopupExtender2"Enabled="True"/
    >




    <ajaxToolkit:ModalPopupExtenderID="ModalPopupExtender2"runat="server"TargetControlID="btnBack"PopupControlID="PNL"OkControlID="ButtonOk"CancelControlID="ButtonCancel"BackgroundCssClass="modalBackground"Enabled="True"/
    >




    <asp:panelID="PNL"Enabled="false"runat="server"style="display:none;
    width:200px; background-color:White; border-width:2px; border-
    color:Black; border-style:solid; padding:20px;">

    Changes have been made. Are you sure you want to continue without
    saving?

    <br/><br/>

    <divstyle="text-align:center;">

    <asp:ButtonID="ButtonOk"runat="server"Text="Yes"OnClick="ButtonOk_Click"CausesValidation="False"Enabled="true"/
    >


    <asp:ButtonID="ButtonCancel"runat="server"Text="No"OnClick="ButtonCancel_Click"CausesValidation="False"Enabled="true"/
    >


    </div>

    </asp:panel>









    </contenttemplate>

    </asp:UpdatePanel>



    Javascript code

    function fnTrapKD(localPNL, localCBE1, localCBE2, localCancel, localOK)
    {

    this.obj = document.getElementById(localPNL);

    if (this.obj.disabled ==true)

    this.obj.disabled = false;

    btnOK = document.getElementById(localOK);

    if (btnOK.disabled ==true)

    btnOK.disabled = false;

    btnCancel = document.getElementById(localCancel);

    if (btnCancel.disabled ==true)

    btnCancel.disabled = false;



    //MPE1 = document.getElementById(localMPE1);

    //alert(MPE1.disabled);

    //if (MPE1.disabled ==true)

    //MPE1.disabled = false;

    //alert(MPE1.id);

    //alert(MPE1.disabled);

    //MPE2 = document.getElementById(localMPE2);

    //alert(MPE2.disabled);

    //if (MPE2.disabled ==true)

    //MPE2.disabled = false;

    //alert(MPE2.id);

    //alert(MPE2.disabled);

    //this commented code was where I was trying to disable the
    // ModalPopupExtender

    alert(localCBE1)
    alert(localCBE2)

    CBE1 = document.getElementById(localCBE1);

    alert(CBE1.disabled);

    if (CBE1.disabled ==true)

    CBE1.disabled = false;

    alert(CBE1.id);

    alert(CBE1.disabled);

    CBE2 = document.getElementById(localCBE2);

    alert(CBE2.style.display);

    if (CBE2.style.display == "none")

    CBE2.style.display = "block";

    alert(CBE2.id);

    alert(CBE2.style.display);



    }

    C# Code in code behind

    protectedvoid Page_Load(object sender, EventArgs e)

    {

    tbPort.Attributes.Add("OnKeyDown", "javascript:fnTrapKD('" +
    this.PNL.ClientID + "','" + this.ConfirmButtonExtender1.ClientID +
    "_CBE_MPE_Placeholder','" + this.ConfirmButtonExtender2.ClientID +
    "_CBE_MPE_Placeholder','" + this.ButtonCancel.ClientID + "','" +
    this.ButtonOk.ClientID + "')");

    }



    Any help on this matter would be great.
    Thanks
    Jason (http://www.Prop2Go.com)
     
    , Jul 3, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. buran
    Replies:
    2
    Views:
    1,823
    buran
    Sep 26, 2003
  2. Patrick
    Replies:
    1
    Views:
    681
  3. Arnab das
    Replies:
    3
    Views:
    2,559
    Arnab das
    Mar 25, 2008
  4. Giri Palakodeti
    Replies:
    0
    Views:
    841
    Giri Palakodeti
    Aug 29, 2008
  5. ll
    Replies:
    2
    Views:
    661
    Thomas 'PointedEars' Lahn
    May 1, 2008
Loading...

Share This Page