我正在使用带有 ASPX 的 EXT.NET。我以前从未遇到过这个问题。当我有一个事件触发器时,页面会重新运行所有代码(尽管它实际上并没有“重新加载”页面)。据我所知,这并没有发生在所有其他页面上。示例代码:
protected void gSelectApplied(object sender,EventArgs e)
{
Ext.Net.ComboBox box = (Ext.Net.ComboBox)sender;
string name = box.ID;
switch (name)
{
case "gPreviousApplied":
{
gPreviousAppliedfunded.Hidden = box.SelectedItem.Value.ToString() == "Yes"
? false
: true;
break;
}
case "gPreviousAppliedfunded":
{
gPreviousApplied.Hidden = box.SelectedItem.Value.ToString() == "Yes"
? false
: true;
break;
}
}
}
这会执行并且应该隐藏页面上的元素。然而,这不会发生,因为它会将 hidden 设置为 true 片刻(甚至不可见),然后它会被重置回来。当我在常规页面中设置断点时,它会在触发事件时触发断点,然后触发事件代码本身。
前端看起来是这样的:
<ext:FormPanel ID="Sec5" runat="server" AutoHeight="true" BodyBorder="false"
Layout="FormLayout" LabelAlign="Right" LabelPad="25" LabelWidth="220" Cls="blue"
PaddingSummary="5px 0px 5px 115px" Border="false" BaseCls=".uData" Hidden="false">
<Items>
<ext:ComboBox FieldLabel="someField" ID="gPreviousApplied"
runat="server" OnDirectSelect="gSelectApplied">
<Items>
<ext:ListItem Text="Yes" />
<ext:ListItem Text="No" />
</Items>
</ext:ComboBox>
<ext:ComboBox FieldLabel="something" ID="gPreviousAppliedfunded"
runat="server">
<Items>
<ext:ListItem Text="Yes" />
<ext:ListItem Text="No" />
</Items>
</ext:ComboBox>
<ext:ComboBox FieldLabel="somethingelse" ID="gPreviousApplied"
runat="server">
<Items>
<ext:ListItem Text="Yes" />
<ext:ListItem Text="No" />
</Items>
</ext:ComboBox>
</Items>
</ext:FormPanel>
</Items>
</ext:Panel>