Dynamiclly Create FileUpLoadFile but it can not get control in code-behind

  1. #1

    Dynamiclly Create FileUpLoadFile but it can not get control in code-behind

        private FileUploadField AddFileUpLoadElement()
            Ext.Net.FileUploadField newElement = new FileUploadField();
            newElement.ButtonText = "Select FIle";
            newElement.Listeners.FileSelected.Handler = "Z_OldTreatment_YX_X.SyncAddFileUpLoadElement();";
            return newElement;
        public void SyncAddFileUpLoadElement()
            bool isadd=true;
            foreach (FileUploadField item in FormPanel_File1.Items)
                if (!item.HasFile)
                    isadd = false;
            if (isadd)
                var test = AddFileUpLoadElement();
                        <ext:FormPanel ID="FormPanel_File1" runat="server" Border="false" Frame="true" AutoRender="true">
    when id debug it,FormPanel_File1.Items.count always 1,can i register it to server?please help
  2. #2
    Hello @LikeWatchStar!

    Anything you change client-side, or thru direct events/methods, that you need later on in code behind should be passed back to the server. The server only knows initial state when the page has loaded. User interactions with the page should be sent back in order to know how the page is at the time of the server-side call.

    You already know how to fetch the items count. Now all that's left is to send it back in the direct method call as illustrated in the Events > DirectMethods > Overview third entry within the example.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] FileUploadFile Filter
    By osef in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 23, 2015, 10:51 AM
  2. [CLOSED] FileUploadFile cleared right after submit
    By bogc in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 15, 2013, 5:58 AM
  3. [CLOSED] Create web server control (composite control)
    By mmmartins in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: May 13, 2011, 6:18 PM
  4. Replies: 0
    Last Post: Sep 25, 2010, 3:28 PM
  5. Replies: 0
    Last Post: May 13, 2009, 7:00 AM

Posting Permissions