Aug 18, 2014, 7:32 AM
[Solved] File Upload Control Messing with Comobox's Value when it is disabled.
First of all Here is the Code and its design.
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.
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.