我有一个像这样的无线电云。
<ext:RadioGroup ID="rdyIsAktifmi" runat="server" FieldLabel="Aktifmi" Width="150"
Flex="1">
<Items>
<ext:Radio ID="Radio4" runat="server" BoxLabel="pasif" InputValue="0" />
<ext:Radio ID="Radio5" runat="server" BoxLabel="aktif" InputValue="1" />
</Items>
</ext:RadioGroup>
我保存了这样的cheched输入值,
rdyIsAktifmi.CheckedItems[0].InputValue //0 or one depents on cheched item
然而,当我从后面的代码绑定它时,我失败了。
我试过这个:
rdyIsAktifmi.CheckedItems[0].Values = employee_obj.IsAktif;(this come from database as integer value)
我也试过这个:
rdyIsAktifmi.CheckedItems[0].Set("rdyIsAktifmi", employee_obj.IsAktif);
如何在InputValue上选择radiobutton从属。
**我正在寻找像这样的methot。
rdyIsAktifmi.CheckedItem.InputValue = employee_obj.IsAktif;
谢谢。答案 0 :(得分:1)
我会这样做。
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Import Namespace="System.Linq" %>
<script runat="server">
protected void Set0(object sender, DirectEventArgs e)
{
Radio r = this.RadioGroup1.Items.Cast<Radio>().First<Radio>(item => item.InputValue == "0");
r.Checked = true;
}
protected void Set1(object sender, DirectEventArgs e)
{
Radio r = this.RadioGroup1.Items.Cast<Radio>().First<Radio>(item => item.InputValue == "1");
r.Checked = true;
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:RadioGroup ID="RadioGroup1" runat="server" ColumnsNumber="1">
<Items>
<ext:Radio ID="Radio1" runat="server" BoxLabel="off" InputValue="0" />
<ext:Radio ID="Radio2" runat="server" BoxLabel="on" InputValue="1" />
</Items>
</ext:RadioGroup>
<ext:Button runat="server" Text="Set 0" OnDirectClick="Set0" />
<ext:Button runat="server" Text="Set 1" OnDirectClick="Set1" />
</form>
</body>
</html>