本文介绍了Ext.Net:radiogruop,使选定的单选按钮取决于其inputValue将的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有这样一个radiogruop。

I have a radiogruop like this.

<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输入值这个样子,

I save the cheched input value like this,

rdyIsAktifmi.CheckedItems[0].InputValue //0 or one depents on cheched item

不过从code结合它落后时我失败了。

however when binding it from code behind I failed.

我trye​​d这一个:

I tryed this one :

 rdyIsAktifmi.CheckedItems[0].Values = employee_obj.IsAktif;(this come from database as integer value)

我也试过这样的:

I also tried this one :

rdyIsAktifmi.CheckedItems[0].Set("rdyIsAktifmi", employee_obj.IsAktif);

我怎么能在其inputValue将选择单选depents。

how I can select radiobutton depents on its InputValue.

**我正好在寻找一个methot这样的事情。

**what I exactly looking for a methot something like this.

rdyIsAktifmi.CheckedItem.InputValue = employee_obj.IsAktif;

rdyIsAktifmi.CheckedItem.InputValue=employee_obj.IsAktif;

感谢您。

推荐答案

我想实现这种方式。

<%@ 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>

这篇关于Ext.Net:radiogruop,使选定的单选按钮取决于其inputValue将的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 17:38