By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,144 Members | 880 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,144 IT Pros & Developers. It's quick & easy.

Enable (show) and Disable (hide) ConfirmButtonExtender

P: n/a
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"ru nat="server"MaxLength="250"/
>

<br/>

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

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


<ajaxToolkit:ModalPopupExtenderID="ModalPopupExten der2"runat="server"TargetControlID="btnBack"PopupC ontrolID="PNL"OkControlID="ButtonOk"CancelControlI D="ButtonCancel"BackgroundCssClass="modalBackgroun d"Enabled="True"/
>


<asp:PanelID="PNL"Enabled="false"runat="server"sty le="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"On Click="ButtonOk_Click"CausesValidation="False"Enab led="true"/
>
<asp:ButtonID="ButtonCancel"runat="server"Text="No "OnClick="ButtonCancel_Click"CausesValidation="Fal se"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 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.