根据另一个字段Dynamic中的选择将字段设置为required

时间:2014-03-11 20:14:07

标签: javascript jquery asp.net ajax

java脚本中是否有任何函数可以动态生成字段?

问题:根据下拉列表的选定值,其他字段应该是必需的,只读和非必需的。

<form id="form1" runat="server">
    <div>
    <dx:ASPxGridView ID="ABC" runat="server" AutoGenerateColumns="False"
                DataSourceID="ABCDataSource" EnableTheming="True"
                 Width="100%" ClientInstanceName="gridABC">
                <Columns>
                    <dx:GridViewCommandColumn Caption="Actions" ShowInCustomizationForm="True" 
                        VisibleIndex="0">
                        <EditButton Visible="True">
                        </EditButton>
                  </dx:GridViewCommandColumn>
                  <dx:GridViewDataComboBoxColumn  Caption="Card Type" FieldName="TypeCard" 
                            ShowInCustomizationForm="True" VisibleIndex="4" >
                            <PropertiesComboBox Width="120px">
                                <Items>
                                    <dx:ListEditItem Text="A" Value="0" />
                                    <dx:ListEditItem Text="B" Value="1" />
                                </Items>
                            </PropertiesComboBox>
                   </dx:GridViewDataComboBoxColumn>
                   <dx:GridViewDataTextColumn Caption="Name"  FieldName="Name" ShowInCustomizationForm="True" 
                        VisibleIndex="2" Width="100px">
                        <PropertiesTextEdit MaxLength="30" Width="100px">
                        </PropertiesTextEdit>
                        <EditFormSettings ColumnSpan="1" VisibleIndex="2" />
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn Caption="Contact"  FieldName="Contact" ShowInCustomizationForm="True" 
                        VisibleIndex="3" Width="100px">
                        <PropertiesTextEdit MaxLength="30" Width="100px">
                        <ValidationSettings>
                                <RequiredField ErrorText="Contact" IsRequired="False" />
                      </ValidationSettings>
                        </PropertiesTextEdit>
                        <EditFormSettings ColumnSpan="1" VisibleIndex="3" />
                    </dx:GridViewDataTextColumn>
           </Columns>
    </dx:ASPxGridView>
    </div>                                          
</form>

有三个字段,如果我选择值&#34; A&#34;来自&#34;卡类型&#34;下拉列表然后应该需要其他两个字段,如果我选择&#34; B&#34;从下拉列表中,这两个字段不应该是强制性的,只读取灰色。

0 个答案:

没有答案