[CLOSED] FileUploadField and dynamic control

  1. #1

    [CLOSED] FileUploadField and dynamic control

    I have FileUploadField on dynamic control. As soon as quantity of dynamic controls can be big, I do not recreate each of them on the server. I'm using parent control direct method to save changes inside of control by passing control id, parameter name and new value. Now I have to attach file to each control. Is it any possibility to pass to parent control direct method stream of the file?
    Last edited by Daniil; Jun 29, 2012 at 12:37 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please clarify what is the parent control? Are you talking about the Page <-> User Controls interaction?
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Please clarify what is the parent control? Are you talking about the Page <-> User Controls interaction?
    Parent control is user control which contain other user controls. So I have page (PAGE), on the page I have user control (PARENTCONTROl) where I load a lot of other user controls (CONRTOL). I do not recreate each CONTROL on the server, but recreating only PARENTCONTROl. On parent control I have DrectMethod SaveData(id, parameter, value). Each CONTROL have checkboxes, textfields and comboboxes. On change event for each ext control I'm calling JS function from PARENTCOTROL which is passing id of CONTROL, parameter name and new value. So I have a problem how to pass/upload file through direct method (PARENTCONTROl.SaveData(id, filestream). So basically I'm looking for the way to upload/save file using DirectMethod, not DirectEvent.
  4. #4
    Thanks for the details, have got the requirement.

    1. The FileUploadField should be within a form.

    2. If that <form> is not global runat form, you should set up
    formProxyArg : 'formId'
    in the DirectMethod config.

    3. Set up
    isUpload : true
    in the DirectMethod config.

    4. Get a file from the Request.Files.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        [DirectMethod]
        public void Upload(string someParameter)
        {
            X.Msg.Alert("Upload", this.Request.Files.Count).Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
        <form id="form1">
            <ext:FileUploadField ID="FileUploadField1" runat="server" Width="300" />
        </form>
    
        <ext:Button runat="server" Text="Upload">
            <Listeners>
                <Click Handler="Ext.net.DirectMethods.Upload('some parameter', {
                                    isUpload     : true,
                                    formProxyArg : 'form1'
                                });" />
            </Listeners>
        </ext:Button>
    </body>
    </html>
  5. #5
    Thanks. You can close the thread

Similar Threads

  1. Fileuploadfield control width problem?
    By i3class in forum 1.x Help
    Replies: 1
    Last Post: Apr 09, 2012, 8:15 AM
  2. FileUploadField and persistence of control field
    By PetrSnobelt in forum 1.x Help
    Replies: 0
    Last Post: Oct 17, 2011, 12:50 PM
  3. Replies: 3
    Last Post: Feb 14, 2011, 6:59 AM
  4. Replies: 0
    Last Post: Nov 11, 2010, 9:15 PM
  5. How to use FileUploadField control?
    By matthaus in forum 1.x Help
    Replies: 0
    Last Post: Jun 01, 2009, 12:32 AM

Tags for this Thread

Posting Permissions