单选按钮选择然后复选框在asp.net中选中 [英] Radio button select then checkbox Checked in asp.net

查看:69
本文介绍了单选按钮选择然后复选框在asp.net中选中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码中给出的三个单选按钮

1)第一个单选按钮选择全部复选框选择

2)第二个单选按钮选择两个复选框选择

怎么做呢???



three Radio button given in below code
1) first radio button select all checkbox select
2) second radio button select two checkbox select
how can do this???

<tabel>
                                <tr>
           <td>
           <asp:RadioButton ID="AllDaysRadioButton" runat="server" Text="All Days Select"
               GroupName="Days" >
           </td>
            </tr>
            <tr>
              <td>
           <asp:RadioButton ID="WeekdaysRadioButton" runat="server" Text ="Only Week Days"
               GroupName="Days" >
           </td>
            </tr>
            <tr>
              <td>
           <asp:RadioButton ID="WeekEndsDaysRadioButton" runat="server"
               Text="Only WeekEnds Days" GroupName="Days" AutoPostBack="True">
           </td>
           </tr>
           <tr>
           <td>
           <asp:CheckBox ID="MondayCheckBox" runat="server" Text="Monday" >
           <asp:CheckBox ID="TuesdayCheckBox" runat="server" Text="Tuesday">
           <asp:CheckBox ID="WednesdayCheckBox" runat="server" Text="Wednesday">
           <asp:CheckBox ID="ThursdayCheckBox" runat="server" Text="Thursday" >
           <asp:CheckBox ID="FridayCheckBox" runat="server" Text="Friday">
           <asp:CheckBox ID="SaturdayCheckBox" runat="server" Text="Saturday">
           <asp:CheckBox ID="SundayCheckBox" runat="server" Text="Sunday">
           </td>
           </tr>
           </tabel>

推荐答案

if(AllDaysRadioButton.isChecked() == true)
{
    MondayCheckBox.Checked = true;
    TuesdayCheckBox.checked = true;
   // write all checkboxes for this..
}
if(WeekdaysRadioButton.isChecked() == true)
{
// enter weekend two checkboxes
}
</pre>


这篇关于单选按钮选择然后复选框在asp.net中选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆