Enable (show) and Disable (hide) ConfirmButtonExtender

J

jason.richard

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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top