问题
I'm seeing strange behaviour from Ext.Net 2.0: RadioGroup.CheckedItems is always zero in my change handler callback. In my code below RadioGroup1.CheckedItems is ALWAYS zero after checking. What am I doing wrong / how can I solve this?
[DirectMethod]
public void TxtVisibility()
{
foreach (var item in RadioGroup1.CheckedItems)
{
if (item.ID == "rdHourly")
{
txtPerHour.Hidden = false;
txtAtTime.Hidden = true;
}
else if (item.ID == "rdAtHourly")
{
txtPerHour.Hidden = true;
txtAtTime.Hidden = false;
}
}
}
My calling code:
<ext:RadioGroup ID="RadioGroup1"
runat="server"
FieldLabel=""
ColumnsNumber="1">
<Items>
<ext:Radio ID="rdHourly" FieldLabel="IsEveryPerHour"
Name="IsEveryPerHour" runat="server"
BoxLabel="Per Hour(s)" Padding="10">
</ext:Radio>
<ext:Radio ID="rdAtHourly" FieldLabel="IsAtHour"
Name="IsAtHour" runat="server"
BoxLabel="At" Padding="10">
</ext:Radio>
</Items>
<Listeners>
<Change Handler="App.direct.TxtVisibility();" ></Change>
</Listeners>
</ext:RadioGroup>
回答1:
I just answered this exact same question on the Ext.NET forums, then came over to Stack to see what's new today... and found this question.
http://forums.ext.net/showthread.php?18364
You might need to wait for the next Ext.NET v2 release. Your sample appears to be working fine with the latest source. There's a complete working example at the link above.
来源:https://stackoverflow.com/questions/10120514/ext-net-radiogroup-checkeditems-is-always-null