Mar 29, 2011, 7:18 AM
The properties of numberfield can not be changed from code-behind in the direct event.
The following is the markup code.
The property of "AllowDecimals" is not changed after the 'H' is selected. But the property of "Disabled" can be changed correctly. Others work fine.
Can anyone tell me the reason? It's very strange.
Thanks a lot.
<ext:Window ID="winCtl" runat="server" Collapsible="false" AutoHeight="true" Icon="ApplicationForm"
Width="400" Hidden="true" Draggable="true" Resizable="false" Modal="true">
<Items>
<ext:FormPanel ID="fpnlCtl" runat="server" ButtonAlign="Right" AutoHeight="true" Header="false"
BodyStyle="background-color:transparent;" Padding="5" LabelAlign="Right" LabelWidth="100">
<Items>
<ext:Hidden ID="hideActionCtl" runat="server" />
<ext:ComboBox ID="ddlCtlPara" runat="server" FieldLabel="Control Parameter" AnchorHorizontal="95%" AllowBlank="false" ForceSelection="true">
<Items>
<ext:ListItem Text="D" Value="D" />
<ext:ListItem Text="H" Value="H" />
<ext:ListItem Text="T" Value="T" />
</Items>
<DirectEvents>
<Select OnEvent="ddlCtlPara_SelectedIndexChanged">
<ExtraParams>
<ext:Parameter Name="CtlPara" Value="#{ddlCtlPara}.getValue()" Mode="Raw" />
</ExtraParams>
</Select>
</DirectEvents>
</ext:ComboBox>
<ext:NumberField ID="txtMAXParaValue" runat="server" FieldLabel="MAXParaValue" AnchorHorizontal="95%" AllowNegative="false" AllowDecimals="false" />
<ext:ComboBox ID="ddlCAType" runat="server" FieldLabel="CA Standard" AnchorHorizontal="95%" />
</Items>
</ext:FormPanel>
</Items>
</ext:Window>
The following is the code-behind. protected void ddlCtlPara_SelectedIndexChanged(object sender, DirectEventArgs e)
{
string strCtlPara = e.ExtraParams["CtlPara"];
if (strCtlPara== "D")
{
txtMAXParaValue.AllowDecimals = false; // Does not work.
// txtMAXParaValue.Disabled = true; // It works.
ddlCAType.ForceSelection = true;
ddlCAType.AllowBlank = false;
ddlCAType.Disabled = false;
}
else
{
if (strCtlPara == "H")
{
txtMAXParaValue.AllowDecimals = true; // Does not work.
txtMAXParaValue.DecimalPrecision = 2; // Does not work.
// txtMAXParaValue.Disabled = false; // It works.
}
else
{
txtMAXParaValue.AllowDecimals = false; // Does not work.
// txtMAXParaValue.Disabled = true; // It works.
}
ddlCAType.ForceSelection = false;
ddlCAType.AllowBlank = true;
ddlCAType.SelectedItem.Value = "";
ddlCAType.Disabled = true;
}
}
Problem Description:The property of "AllowDecimals" is not changed after the 'H' is selected. But the property of "Disabled" can be changed correctly. Others work fine.
Can anyone tell me the reason? It's very strange.
Thanks a lot.
Last edited by Santon_Lee; Mar 29, 2011 at 7:36 AM.