Solved

Disabling then reenabling a button in a confirmation box

Posted on 2011-02-11
1
441 Views
Last Modified: 2012-05-11
Hi,

I'm trying to use AJAXControlToolKit to create a confirmation box that allows a user to upload a file. There's also an "OK" and a "Cancel" button on the confirmation box. For the most part it's all working, however I need to disable the "OK" button when the upload starts then reenable it when the upload is completed because allowing the user to press "OK" during upload throws an exception. I've already looked into setting the upload to start on the "OK" button click event but due to different instances of an argument this doesn't seem like an option.

This is the what builds the box when the event is called

 
protected void cnfUpload_Actioned(object sender, ConfirmationBoxEventArgs e)
    {
        e.ButtonStyle = ConfirmationBoxButtonStyle.AcknowledgeCancelUpload;
        e.Message = "Select a WAV file to upload...";
        e.Icon = ConfirmationBoxIcons.Information;
        Session.Contents["UploadedFile"] = null;
        Session.Contents["FileName"] = null;
    }

Open in new window


This is the event where the upload takes place and where I'd like the disable and reenable the "OK" button.

 
protected void cbUpload_Uploaded(object sender, ConfirmationBoxEventArgs e)
    {
        //List View Upload - leads to edit
        ConfirmationBox cb = sender as ConfirmationBox; 
        
        byte[] bFile = new byte[e.DataStream.Length];
        e.DataStream.Read(bFile, 0, Convert.ToInt32(e.DataStream.Length));

        try
        {
            //PromptData.SetAudio(Convert.ToInt32(cb.Reference), e.Filename, bFile);

            Prompt.SetAudio(Convert.ToInt32(cb.Reference), e.Filename, AudioFile.ConvertToALaw(bFile));
            SessionManager.UploadError = false;
        }
        catch (Exception ex)
        {
            SessionManager.UploadError = true;
            diags.Error(Request, "Could not upload Temporary File", ex);
        }
    }

Open in new window


This is the code that builds the confirmation box on click of a button

<sso:ConfirmationBox ID="cbUpload" runat="server" 
                            ShowCancelButton="false"
                            ButtonStyle="AcknowledgeCancelUpload"
                            ActionButtonStyle="Image"
                            Reference='<%# Eval("ID") %>'
                            ActionButtonImage="~/Icons/16x16/ictupload.png"
                            OnActioned="cnfUpload_Actioned"
                            OnFileUploaded="cbUpload_Uploaded"
                            OnAcknowledgeClicked="cbUpload_AcknowledgeClicked"
                            OnCancelClicked="cbUpload_CancelClicked"
                            ActionImageAlt="Upload"
                         />

Open in new window


Apologies if I have not included enough information/code. But any help would be appreciated.

Many thanks.
0
Comment
Question by:Lilliman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Lilliman earned 0 total points
ID: 34896719
It seems that there isn't an ovbious way of doing this but I have managed to get around it by using  div tags in where the confirmation box is referenced and set the button's visibility to false, then I have used a small piece of javascript to set the button's visibility back to true again  when it's needed.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question