[CLOSED] FileUploadField causes a problem when firing a direct event of a button

  1. #1

    [CLOSED] FileUploadField causes a problem when firing a direct event of a button

    Hi,

    As the topic title, I get the following error as firing a direct event of a button
    Click image for larger version. 

Name:	fileuploadfield.png 
Views:	192 
Size:	35.1 KB 
ID:	4236

    Please tell me how to prevent that. I can guest the reason is that the form has been set enctype to multipart/form-data.

    <head runat="server">
       <title></title>
       <script runat="server">
        protected void UploadClick(object sender, DirectEventArgs e)
        {
            string tpl = "Uploaded file: {0}<br/>Size: {1} bytes";
            
            if (this.FileUploadField1.HasFile)
            {
               X.Msg.Show(new MessageBoxConfig
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.INFO,
                    Title = "Success",
                    Message = string.Format(tpl, this.FileUploadField1.PostedFile.FileName, this.FileUploadField1.PostedFile.ContentLength)
                });
            }
            else
            {
               X.Msg.Show(new MessageBoxConfig
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.ERROR,
                    Title = "Fail",
                    Message = "No file uploaded"
                });
            }
        }
          protected void ErrorClick_Event(object sender, DirectEventArgs e)
          {
          }
    
    
    </script>
    </head>
    <body>
       <form id="form1" runat="server">
       <ext:ResourceManager runat="server">
       </ext:ResourceManager>
       <ext:FormPanel ID="BasicForm" runat="server" Width="500" Frame="true" Title="File Upload Form"
          AutoHeight="true" PaddingSummary="10px 10px 0 10px" LabelWidth="50">
          <Defaults>
             <ext:Parameter Name="anchor" Value="95%" Mode="Value" />
             <ext:Parameter Name="allowBlank" Value="false" Mode="Raw" />
             <ext:Parameter Name="msgTarget" Value="side" Mode="Value" />
          </Defaults>
          <Items>
             <ext:TextField ID="PhotoName" runat="server" FieldLabel="Name" />
             <ext:FileUploadField ID="FileUploadField1" runat="server" EmptyText="Select an image"
                FieldLabel="Photo" ButtonText="" Icon="ImageAdd"/>
          </Items>
          <Listeners>
             <ValidityChange Handler="#{SaveButton}.setDisabled(!valid);" />
          </Listeners>
          <Buttons>
             <ext:Button runat="server" ID="btnError" Text="Post back" Icon="Error">
                <DirectEvents>
                   <Click OnEvent="ErrorClick_Event"></Click>
                </DirectEvents>
             </ext:Button>
             <ext:Button ID="SaveButton" runat="server" Text="Save">
                <DirectEvents>
                   <Click OnEvent="UploadClick" Before="if (!#{BasicForm}.getForm().isValid()) { return false; } 
                                    Ext.Msg.wait('Uploading your photo...', 'Uploading');" Failure="Ext.Msg.show({ 
                                    title   : 'Error', 
                                    msg     : 'Error during uploading', 
                                    minWidth: 200, 
                                    modal   : true, 
                                    icon    : Ext.Msg.ERROR, 
                                    buttons : Ext.Msg.OK 
                                });">
                   </Click>
                </DirectEvents>
             </ext:Button>
             <ext:Button ID="Button1" runat="server" Text="Reset">
                <Listeners>
                   <Click Handler="#{BasicForm}.getForm().reset();" />
                </Listeners>
             </ext:Button>
          </Buttons>
       </ext:FormPanel>
       </form>
    </body>
    Last edited by Daniil; May 15, 2012 at 8:47 AM. Reason: [CLOSED]
  2. #2
    Hi,

    I am unable to reproduce the problem.

    Please clarify what Ext.NET sources do you use? If not the latest one from SVN, please update and re-test.
  3. #3
    Hi,

    It is now working after updating svn. Thanks for your help.

    One question : how often do you update it on Nuget?
  4. #4
    Quote Originally Posted by thchuong View Post
    One question : how often do you update it on Nuget?
    Currently, we don't update NuGet, only on releases. Beta 2 should appear soon.

Similar Threads

  1. Desktop Window gridpanel direct event not firing
    By Karun Javvadi in forum 2.x Help
    Replies: 0
    Last Post: Jul 31, 2012, 12:16 PM
  2. [CLOSED] Button Issue Direct Event (IE6-IE7-IE8)
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 10, 2011, 6:23 AM
  3. [CLOSED] Button event firing twice?
    By geodan in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Aug 18, 2010, 7:03 PM
  4. [CLOSED] Layout problem and Direct Event keeps firing
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 14, 2010, 5:01 PM
  5. [CLOSED] FileUploadField not firing FileSelected event
    By SFritsche in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 05, 2010, 11:15 AM

Posting Permissions