第一次接触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. 华为oj - 统计大写字母个数

    练手而已. 给初学者参考 #include <stdio.h> #include <string.h> int main(void) { char string[200]={' ...

  2. iPhoneKeyboard

    iPhoneKeyboard.Open static function Open (text : string, keyboardType : iPhoneKeyboardType = iPhoneK ...

  3. 1、工程log4j 配置

    ### set log levels ### log4j.rootLogger = debug,stdout,R ### 输出到控制台 ### log4j.appender.stdout = org. ...

  4. hdu 1019 n个数的最小公倍数

    The least common multiple (LCM) of a set of positive integers is the smallest positive integer which ...

  5. MySQL指令记录(Wampserve环境)

    1.MySQL在Wampserve中的默认用户名为'root',默认密码为空: 2.显示所有数据库 show databases; 3.切换数据库 use DATABASE_NAME; 4.列出所有表 ...

  6. C++友元函数重载"++"和"--"运算符

    代码: #include <iostream> #include <cstring> using namespace std; class one{ public: one(i ...

  7. Java中的int和Integer

    代码: public class Test{ public static void main(String[] args){ Integer i01 = 59; int i02 = 59; Integ ...

  8. BestCoder Round #36 (hdu5200)Strange Class(离线)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Trees Time Limit: 2000/1000 MS (Java/Othe ...

  9. C++常量指针与常量数据

    常量指针即指针是常量的,一但声明指向某个数据后不能被更改,但是指向的数据可以被更改.声明格式如下: ; int * const p = &demo; 常量数据是指数据是常量的,一但被初始化后不 ...

  10. js工厂模式

    设计工厂模式是为了创建对象.通常在类或者类的静态方法中实现,具有两个目标.其中一个是:当创建相似对象时执行重复操作: 另外一个目标是:编译时不知道具体类型(类)的情况下,为工厂客户提供一种创建对象的接 ...