Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Enable (show) and Disable (hide) ConfirmButtonExtender

Reply
Thread Tools

Enable (show) and Disable (hide) ConfirmButtonExtender

 
 
jason.richard@gmail.com
Guest
Posts: n/a
 
      07-03-2008
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"/
>




<aspanelID="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>

</aspanel>









</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)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgernt help - ConfirmButtonExtender and targetcontrol link button Giri Palakodeti ASP .Net 0 08-29-2008 07:03 PM
Javascript error for ConfirmButtonExtender & Modal popup Arnab das ASP .Net 3 03-25-2008 05:38 AM
How to enable people to pay me....(enable credit card payments in my web app) Patrick ASP .Net 1 11-10-2005 11:07 AM
how to enable/disable validation controls in the web user control and main page... buran ASP .Net 2 09-26-2003 06:29 PM
how to group validation controls and enable/disable them buran ASP .Net 0 09-26-2003 12:51 PM



Advertisments