首页 技术 正文
技术 2022年11月21日
0 收藏 891 点赞 2,690 浏览 1432 个字

第一次接触RadioBttonList时候,觉得这个控件完全可以取代RadioButton,操作更加简便。直到今天,完成了一个小小的功能,才发现,尺有所短不是瞎掰的。

需求如下:

Add Proration Rate radio buttons.

  • Radio button for a fixed rate

    • Selected by default
    • Meaning using HR user for calculation
  • Radio button for Based on old logic

RadioButton 和 RadioButtonList 比较

亲爱的Radio之间隔了其他控件,于是,List毫无用武之地。只能定义Group将Radio绑在一组内。

前台

 <table>
<tr>
<td class="font12 bold dkgray right" width="">
&nbsp;&nbsp;<asp:Label runat="server" ID="Label20">Proation Rate:</asp:Label>
</td>
<td class="font12 bold dkgray" width="">
<asp:RadioButton ID="rbFixed" runat="server" Checked="True"
GroupName="Proation" AutoPostBack="True"
oncheckedchanged="rbFixed_CheckedChanged" />
<asp:TextBox ID="txtFixedRate" runat="server" MaxLength=""></asp:TextBox>
<asp:Label runat="server" ID="Label21">(A fixed rate, int the format decimal number)</asp:Label>
<asp:Label runat="server" ID="lblProationRate" ForeColor="red" ></asp:Label>
<br />
<asp:RadioButton ID="rbOld" runat="server" GroupName="Proation"
oncheckedchanged="rbOld_CheckedChanged" AutoPostBack="True" />
<asp:Label runat="server" ID="Label22">Based on old logic ((Effective Date - Last increase Date - LOA days )/)</asp:Label>
</td>
</tr>
</table>

后台的话 监听事件就会麻烦一点点。不知道对不对呢,明天才能见分晓。

后台

        protected void rbOld_CheckedChanged(object sender, EventArgs e)
{
if (rbOld.Checked)
{
txtFixedRate.Text = string.Empty;
txtFixedRate.Enabled = false;
lblProationRate.Text = string.Empty;
} } protected void rbFixed_CheckedChanged(object sender, EventArgs e)
{
if (rbFixed.Checked) txtFixedRate.Enabled = true;
}

另 清楚RadiobuttonList所有选中项的方法:   RadioButtonList1.ClearSelection();

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,987
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,503
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,347
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,130
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,765
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,842