0

Ext.net の分離コードで、選択したラジオ ボタンに基づいて ComboBox や DateFields を非表示にしようとしています。

                        <Items>
                            <ext:Container ID="Container1" runat="server" Layout="ColumnLayout" Height="175" Width="418" >
                               <Items>
                                    <ext:RadioGroup  runat="server" ID="ChooseSpan" Selectable="true" ColumnsNumber="1" ColumnWidth="0.50"  >
                                        <Items>
                                            <ext:Radio ID="RadioAll" runat="server" BoxLabel="Show All" InputValue="0" />
                                            <ext:Radio ID="RadioMonth" runat="server" BoxLabel="Choose Date Range(By Month)" InputValue="1" />
                                            <ext:Radio ID="RadioDate" runat="server" BoxLabel="Choose Date Range(By Dates)" InputValue="2" />
                                        </Items>
                                    </ext:RadioGroup>
                                    <ext:Container ID="Container2" runat="server" Layout="RowLayout" Height="175" ColumnWidth="0.50" StyleSpec="margin-top:25px;">
                                        <Items>
                                            <ext:ComboBox runat="server" ID="MonthComboBox" Selectable="true" SelectedIndex="0" >
                                                <Items>
                                                    <ext:ListItem Text="Any Month" Value="0" />
                                                    <ext:ListItem Text="January" Value="1" />   
                                                    <ext:ListItem Text="February" Value="2" />
                                                    <ext:ListItem Text="March" Value="3" />
                                                    <ext:ListItem Text="April" Value="4" />
                                                    <ext:ListItem Text="May" Value="5" />
                                                    <ext:ListItem Text="June" Value="6" />
                                                    <ext:ListItem Text="July" Value="7" />
                                                    <ext:ListItem Text="August" Value="8" />
                                                    <ext:ListItem Text="September" Value="9" />
                                                    <ext:ListItem Text="October" Value="10" />
                                                    <ext:ListItem Text="November" Value="11" />
                                                    <ext:ListItem Text="December" Value="12" />
                                                </Items>
                                            </ext:ComboBox>
                                            <ext:DateField
                                                ID="StartDateField"
                                                runat="server"
                                                FieldLabel="Start"
                                                Vtype="daterange"
                                                AnchorHorizontal="100%"
                                                EnableKeyEvents="true">
                                                <CustomConfig>
                                                    <ext:ConfigItem Name="endDateField" Value="#{EndDateField}" Mode="Value" />
                                                </CustomConfig>
                                                <Listeners>
                                                    <%--<Select Handler="#{DirectMethods}.SubmitDate();" />--%>
                                                </Listeners>
                                            </ext:DateField>

                                            <ext:DateField 
                                                ID="EndDateField" 
                                                runat="server" 
                                                Vtype="daterange"
                                                FieldLabel="End"
                                                AnchorHorizontal="100%"
                                                EnableKeyEvents="true">
                                                <CustomConfig>
                                                    <ext:ConfigItem Name="startDateField" Value="#{StartDateField}" Mode="Value" />
                                                </CustomConfig>
                                                <Listeners>
                                                    <%-- <Select Handler="#{DirectMethods}.SubmitDate();" />--%>
                                                </Listeners>
                                            </ext:DateField>
                                            <ext:Button ID="Next" runat="server" Text="Next" MaxWidth="50" StyleSpec="margin-left:159px; margin-top:150;" >

                                            </ext:Button>
                                        </Items>
                                    </ext:Container>
                                </Items>
                            </ext:Container>
                        </Items>
                    </ext:Panel>
                </Items>

C# を使用したコード ビハインドは次のとおりです。

    [DirectMethod]
    public void DateSelection()
    {

        if (ChooseSpan.CheckedItems[0].ID == "RadioAll")
        {
            MonthComboBox.Visible = false;
            StartDateField.Visible = false;
            EndDateField.Visible = false;
        }
        if (ChooseSpan.CheckedItems[0].ID == "RadioMonth")
        {
            MonthComboBox.Visible = true;
            MonthComboBox.Show();
            StartDateField.Visible = false;
            EndDateField.Visible = false;
        }
        if (ChooseSpan.CheckedItems[0].ID == "RadioDate")
        {
            MonthComboBox.Visible = false;
            StartDateField.Visible = true;
            StartDateField.Show();
            EndDateField.Visible = true;
            EndDateField.Show();
        }
    }

これらの選択を受け入れるには、RadioGroup にリスナーが必要ですか? コードビハインドを選択に応答させ、非表示にするかどうかを指定するにはどうすればよいですか?

4

1 に答える 1

1

サーバー メソッドを呼び出すには、RadioGroup の Change イベントをリッスンしてください。

コンポーネントを非表示/表示するには、Visible の代わりに Hidden プロパティを使用してください。ここでは違いについて少し詳しく説明します。

同様に、Show メソッドと Hide メソッドを使用できます。

于 2013-05-01T16:52:05.197 に答える