Compilation error when trying to overload click event

Last post 10-05-2012, 4:42 AM by Jeff. 3 replies.
Sort Posts: Previous Next
  •  10-03-2012, 6:51 AM 74844

    Compilation error when trying to overload click event

    Hi,

     

    I'm trying to disable the "submit" button on my page when there are no items to be submitted to the page. This is my UploadAttachments:

    1. <CuteWebUI:UploadAttachments runat="server" ID="ajaxBinaryAttach" InsertButtonID="btnMultipleAttachment" OnUploadCompleted="enableSubmitBtn" OnAttachmentRemoveClicked="disableSubmitBtn"/>  
     This is the code for disableSubmitBtn, which should be called when the remove button is clicked:

     

    1. protected void disableSubmitBtn(object sender, UploaderEventArgs[] args) {  
    2.      if (ajaxBinaryAttach.Items.Count==0) {  
    3.            btnSubmitMultiple.Enabled = true;  
    4.      }   
    5. }  
     I get this error message when i try to load the page:

     

     Compiler Error Message: CS0123: No overload for 'disableSubmitBtn' matches delegate 'CuteWebUI.AttachmentItemEventHandler'

    Is there any way for me to execute the code in disableSubmitBtn() before the ajaxuploader deals with the rest of what's supposed to happen when the user clicks the remove button?

     

    Best regards,

    trbox 

  •  10-03-2012, 8:54 PM 74849 in reply to 74844

    Re: Compilation error when trying to overload click event

    Dear trbox,

     

    the correct delegate event is the snippet code below. 

    1.  void disableSubmitBtn(object sender, AttachmentItemEventArgs args)  
    2.  {  
    3.      if (ajaxBinaryAttach.Items.Count == 0)  
    4.      {  
    5.          btnMultipleAttachment.Enabled = true;  
    6.      }     
    7.  }  

     

    Regards,

    Jeff 

  •  10-04-2012, 3:34 AM 74855 in reply to 74849

    Re: Compilation error when trying to overload click event

    Wow, you guys respond fast. I love it!

     

    Changing the arguments in the method from UploaderEventArgs to AttachmentItemEventArgs fixed the error. So now my web page runs fine when I press the remove button on the attachment items, but my submit button still stays active even though there are no items in the list. 

     

    Does the uploader somehow override the changes I make when the button is rendered?

     

    To clarify further, here is all the code involved in this:

     

    1. <asp:Button ID="btnMultipleAttachment" runat="server" Text="Browse" CssClass="button" />                     
    2. <CuteWebUI:UploadAttachments runat="server" ID="ajaxBinaryAttach"       InsertButtonID="btnMultipleAttachment" OnUploadCompleted="enableSubmitBtn" OnAttachmentRemoveClicked="disableSubmitBtn"
    3. <ValidateOption MaxSizeKB="153600" AllowedFileExtensions="iso,zip,png,bmp,xml" />     
    4. </CuteWebUI:UploadAttachments>  
    5. <asp:Button ID="btnSubmitMultiple" runat="server" Text="Submit attachments" visible="true" Enabled="false" OnClick="btnSubmitMultiple_Click" />  
    6.   
    7. void enableSubmitBtn(object sender, UploaderEventArgs[] args)  
    8.         {  
    9.   
    10.             btnSubmitMultiple.Enabled = true;  
    11.   
    12.         }  
    13.   
    14. void disableSubmitBtn(object sender, AttachmentItemEventArgs args)  
    15.         {  
    16.             if (ajaxBinaryAttach.Items.Count == 0)  
    17.             {  
    18.                 btnSubmitMultiple.Enabled = false;  
    19.             }  
    20.         }  
     

  •  10-05-2012, 4:42 AM 74866 in reply to 74855

    Re: Compilation error when trying to overload click event

    I think you can debug these two mehods, you can find which method runs first.

     

    Regards,

    Jeff 

View as RSS news feed in XML