[Bug Report] File Upload Control Messing with Comobox's Value when it is disabled.

  1. #1

    [Solved] File Upload Control Messing with Comobox's Value when it is disabled.

    First of all Here is the Code and its design.

    protected void Page_Load(object sender, EventArgs e)
            {
                ComboBox1.SelectedItem.Index = 0;
            }
    
            public void ClickThis(object sender, DirectEventArgs e)
            {
                if (fileUpload1.HasFile)
                {
                    X.Msg.Alert("", txt1.Text + "</br>"
                        + txt2.Text + "</br>"
                        + ComboBox1.SelectedItem.Value + "</br>"
                        + ComboBox2.SelectedItem.Value).Show();
                }
                else
                {
                    X.Msg.Alert("", "File Chaina").Show();
                }
            }

    
    <ext:TextField ID="txt1" runat="server" Disabled="true" Margin="7" Text="Hello"></ext:TextField>
        <ext:TextField ID="txt2" runat="server" Disabled="false" Margin="7"></ext:TextField>
    
        
            <ext:ComboBox ID="ComboBox1" runat="server" Editable="false" QueryMode="Local" TriggerAction="All" Margin="7"
                    EmptyText="Select a country" Disabled="true">
                    <Items>
                        <ext:ListItem Text="Nepal" Value="NP" />
                        <ext:ListItem Text="Belgium" Value="BE" />
                        <ext:ListItem Text="Brazil" Value="BR" />
                        <ext:ListItem Text="Bulgaria" Value="BG" />
                        <ext:ListItem Text="Canada" Value="CA" />
                        <ext:ListItem Text="Chile" Value="CL" />
                        <ext:ListItem Text="Cyprus" Value="CY" />
                        <ext:ListItem Text="Finland" Value="FI" />
                        <ext:ListItem Text="France" Value="FR" />
                        <ext:ListItem Text="Germany" Value="DE" />
                        <ext:ListItem Text="Hungary" Value="HU" />
                        <ext:ListItem Text="Ireland" Value="IE" />
                        <ext:ListItem Text="Israel" Value="IL" />
                        <ext:ListItem Text="Italy" Value="IT" />
                        <ext:ListItem Text="Lithuania" Value="LT" />
                        <ext:ListItem Text="Mexico" Value="MX" />
                        <ext:ListItem Text="Netherlands" Value="NL" />
                        <ext:ListItem Text="New Zealand" Value="NZ" />
                        <ext:ListItem Text="Norway" Value="NO" />
                        <ext:ListItem Text="Pakistan" Value="PK" />
                        <ext:ListItem Text="Poland" Value="PL" />
                        <ext:ListItem Text="Romania" Value="RO" />
                        <ext:ListItem Text="Slovakia" Value="SK" />
                        <ext:ListItem Text="Slovenia" Value="SI" />
                        <ext:ListItem Text="Spain" Value="ES" />
                        <ext:ListItem Text="Sweden" Value="SE" />
                        <ext:ListItem Text="Switzerland" Value="CH" />
                        <ext:ListItem Text="United Kingdom" Value="GB" />
                    </Items>
                </ext:ComboBox>
    
                <ext:ComboBox ID="ComboBox2" runat="server" Editable="false" QueryMode="Local" TriggerAction="All" Margin="7"
                    EmptyText="Select a country">
                    <Items>
                        <ext:ListItem Text="Nepal" Value="NEP" />
                        <ext:ListItem Text="Belgium" Value="BE" />
                        <ext:ListItem Text="Brazil" Value="BR" />
                        <ext:ListItem Text="Bulgaria" Value="BG" />
                        <ext:ListItem Text="Canada" Value="CA" />
                        <ext:ListItem Text="Chile" Value="CL" />
                        <ext:ListItem Text="Cyprus" Value="CY" />
                        <ext:ListItem Text="Finland" Value="FI" />
                        <ext:ListItem Text="France" Value="FR" />
                        <ext:ListItem Text="Germany" Value="DE" />
                        <ext:ListItem Text="Hungary" Value="HU" />
                        <ext:ListItem Text="Ireland" Value="IE" />
                        <ext:ListItem Text="Israel" Value="IL" />
                        <ext:ListItem Text="Italy" Value="IT" />
                        <ext:ListItem Text="Lithuania" Value="LT" />
                        <ext:ListItem Text="Mexico" Value="MX" />
                        <ext:ListItem Text="Netherlands" Value="NL" />
                        <ext:ListItem Text="New Zealand" Value="NZ" />
                        <ext:ListItem Text="Norway" Value="NO" />
                        <ext:ListItem Text="Pakistan" Value="PK" />
                        <ext:ListItem Text="Poland" Value="PL" />
                        <ext:ListItem Text="Romania" Value="RO" />
                        <ext:ListItem Text="Slovakia" Value="SK" />
                        <ext:ListItem Text="Slovenia" Value="SI" />
                        <ext:ListItem Text="Spain" Value="ES" />
                        <ext:ListItem Text="Sweden" Value="SE" />
                        <ext:ListItem Text="Switzerland" Value="CH" />
                        <ext:ListItem Text="United Kingdom" Value="GB" />
                    </Items>
                </ext:ComboBox>
    
        <ext:FileUploadField runat="server" ID="fileUpload1" Margin="7">
        </ext:FileUploadField>
        <ext:Button ID="btn1" runat="server" Text="Testing" Width="100" Height="45" Margin="7">
            <DirectEvents>
                <Click OnEvent="ClickThis">
                </Click>
            </DirectEvents>
        </ext:Button>
    In the Design above notice that ComboBox1 and txt1 are disabled. Now the Problem is whenever in page where File Upload Control is used it clears the selecteditem value of the Disabled Combobox. In the example above I have tried to Show the Values inside 4 controls in popup in Button Click event. Two TextFields and Two Comboboxes. Now Value of 2 TextFields and Combobox2 is shown properly but selected item's Value is not shown whenever its Disabled property is set to be true. If The page has file upload control and Disabled property of combobox is set false it works fine.

    Now I am saying it is a bug because after I remove that File Upload Control from that page the same code starts to show the values for all four controls properly even if the Disabled property of Combobox is set true.
    Last edited by sailendra; Aug 18, 2014 at 10:49 AM.
  2. #2
    Hi

    According W3C specification, disabled form elements (input elements) are not submitable
    So, if you use classic HTML form submit then disbaled elements will not be added to request

    Ext.Net changes that behaviour if DirectEvent is used (disabled fiedls are submitable)

    If you use FileUpload field then Ext.Net cannot use direct (ajax) request because ajax request cannot transmit binary data
    Instead ajax request, Ext.Net will use classic html form submit but inside hidden iframe to avoid page reloading. But as I said classic html form will not submit disabled fields (according W3C specification). So, it is expected behaviour

    I suggest to place File field inside different form element (use two different form elements) or pass disabled fields as extra params

Similar Threads

  1. [CLOSED] Multiple file support to upload in file upload control
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 01, 2013, 9:41 AM
  2. [CLOSED] Asp file upload control on framework 4.5 with ext.net 2.1
    By stoque in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 06, 2012, 12:04 AM
  3. File Upload Control
    By dan182 in forum 1.x Help
    Replies: 3
    Last Post: Apr 02, 2012, 2:49 PM
  4. [CLOSED] Drag file to upload control
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 13, 2012, 4:31 PM
  5. [CLOSED] File upload control not working in IE8
    By majestic in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Dec 15, 2011, 4:02 PM

Tags for this Thread

Posting Permissions