第一次接触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

亲爱的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();

RadioButton 和 RadioButtonList 比较的更多相关文章

  1. .net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法实例?

    .net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法,区别? RadioButton实例及说明: <asp:RadioButton ID=& ...

  2. webform控件

    简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 <asp:Label ID=" CssClass="aaa&qu ...

  3. webform简单、复合控件

    简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 2.Literal 空的,C#会把里 ...

  4. WebForm简单控件,复合控件

    简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 __________________ ...

  5. ASP.NET中控件命名规则

    控件名 简写 控件名 简写 Web 窗体 Label lbl TextBox tb Button btn LinkButton lb HyperLink hl Repeator rpt ImageBu ...

  6. C#编码标准

    一.命名约定 1.PascalCasting PascalCasing 每一个单词第一个字母大写,其余字母均小写.例如:FileAccess,ArraySegment等. 除了参数.变量.常量外,所有 ...

  7. Visual Studio C#的winform/webform/asp.net控件命名规范

    控件命名规范 类型 前缀 示例 AdRotator adrt adrtTopAd Button btn btnSubmit Calendar cal calMettingDates CheckBox ...

  8. webform简单控件

    表单元素: 文本类: text password textarea hidden text,password,textarea实现控件:textbox   textmode属性选择password或m ...

  9. C#控件前缀命名规范

    标准控件 1  btn Button 2  chk CheckBox 3  ckl CheckedListBox 4  cmb ComboBox 5  dtp DateTimePicker 6  lb ...

随机推荐

  1. using 关键字给类和名称空间指定别名

    1. using System; using System.Text; namespace DLL { public class Class1 { public void showStr() { Co ...

  2. WebApi2官网学习记录---Tracing

    安装追踪用的包 Install-Package Microsoft.AspNet.WebApi.Tracing Update-Package Microsoft.AspNet.WebApi.WebHo ...

  3. ajax例子

    <!DOCTYPE html> <html> <head> <title></title> </head> <body&g ...

  4. 《第一行代码》学习笔记10-活动Activity(8)

    1.除了onRestart()方法,其他都是两两相对的.三种生存期: (1)完整生存期:onCreate()~onDestroy().一般情况下,一个活动会在onCreate()中完成各种初始化操作, ...

  5. gitweb随记

    1.安装gitweb,命令安装即可 apt-get install gitweb 2.clone cgi $ git clone git://git.kernel.org/pub/scm/git/gi ...

  6. OpenSuse13.2硬盘安装

    直接参考文章:OpenSuse硬盘安装 补充: Win7引导Grub4dos时,本人尝试根据xp引导方式中使用boot.ini来引导,引导成功,不需要bcdedit命令,简化了引导步骤.

  7. 慕课linux学习笔记(七)常用命令(4)

    帮助命令 Man命令 Man的级别 命令帮助 可被内核调用的函数帮助 函数和函数库帮助 特殊文件帮助 /dev 配置文件帮助 游戏的帮助 其他杂项的帮助 管理员可用命令帮助 内核相关文件的帮助 -f ...

  8. 让footer在底部(测试它人方法)

    要求:网页布局中,页脚在底部.内容不够一页时,在底部.内容超过一页时,出现卷动条,页脚也在被挤到底部 1.测试的这个文章介绍的办法   链接: http://www.cnblogs.com/cheny ...

  9. UVA 12169 Disgruntled Judge

    我该怎么说这道题呢...说简单其实也简单,就枚举模拟,开始卡了好久,今天看到这题没a又写了遍,看似会超时的代码交上去a了,果然实践是检验真理的唯一标准... #include <iostream ...

  10. 利用Azure高级存储搭建高性能Linux服务器(1)

    目前Azure针对虚拟机提供两种类型的存储,一种是标准存储,基于HDD的,一种是高性能存储Premium Storage(在下文中简称PS),基于SSD的.针对用户高性能,低延迟,I/O密集型的应用, ...