RadioButton 和 RadioButtonList 比较
第一次接触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="">
<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 比较的更多相关文章
- .net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法实例?
.net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法,区别? RadioButton实例及说明: <asp:RadioButton ID=& ...
- webform控件
简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 <asp:Label ID=" CssClass="aaa&qu ...
- webform简单、复合控件
简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 2.Literal 空的,C#会把里 ...
- WebForm简单控件,复合控件
简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 __________________ ...
- ASP.NET中控件命名规则
控件名 简写 控件名 简写 Web 窗体 Label lbl TextBox tb Button btn LinkButton lb HyperLink hl Repeator rpt ImageBu ...
- C#编码标准
一.命名约定 1.PascalCasting PascalCasing 每一个单词第一个字母大写,其余字母均小写.例如:FileAccess,ArraySegment等. 除了参数.变量.常量外,所有 ...
- Visual Studio C#的winform/webform/asp.net控件命名规范
控件命名规范 类型 前缀 示例 AdRotator adrt adrtTopAd Button btn btnSubmit Calendar cal calMettingDates CheckBox ...
- webform简单控件
表单元素: 文本类: text password textarea hidden text,password,textarea实现控件:textbox textmode属性选择password或m ...
- C#控件前缀命名规范
标准控件 1 btn Button 2 chk CheckBox 3 ckl CheckedListBox 4 cmb ComboBox 5 dtp DateTimePicker 6 lb ...
随机推荐
- Visual Studio 2015 开发MVC4出现错误
在Visual Studio 2015(以下简称VS2015)中开发MVC4项目时,编译报错"当前上下文中不存在ViewBag",一直无法编译,这个是否是VS2015的Bug? 本 ...
- WebApi2官网学习记录---单元测试
如果没有对应的web api模板,首先使用nuget进行安装 例子1: ProductController 是以硬编码的方式使用StoreAppContext类的实例,可以使用依赖注入模式,在外部指定 ...
- [C#][Database]C#通过ODBC以自定义端口连接数据库
数据库端的配置暂且不说,比较简单,新建用户并开启相应连接权限即可. 通过ODBC连接数据库,重点在于Connection String的书写,在此可以查到几乎所有类型的Data Server的Conn ...
- SQL Server 向临时表插入数据
INSERT INTO #DirtyOldWIPBOM SELECT TOP (100) PERCENT dbo.WIP_BOM.Model, dbo.WIP_BOM.PartNumber,WIP_B ...
- (二)backbone - DEMO - user list
Demo介绍 学习了如何基本的使用Backbone,展示用户信息 使用JQuery操作DOM,backbone.localStorage.js操作localstorage 大体实现 •创建user M ...
- Jquery函数实现时间显示模式为更新于+被当前时间减去后剩余的时间值(例如:更新于三小时前)的处理。
var time_eles = $(".time_tranfer"); for(var i =0; i < time_eles.length;i++){ var time_e ...
- PAT 64.Complete Binary Search Tree
题目链接: http://pat.zju.edu.cn/contests/pat-a-practise/1064 思路分析: 1)先对数组排好序. 2)采用中序遍历的方式,将排好序的元素逐个插入在完全 ...
- Java系列--第一篇 Maven+Spring+Spring MVC+mybatis 示例
基于Maven的Spring+SpringMVC+Mybatis的一个小项目的搭建,由于使用Maven3.1.0管理,所以Spring等都将使用的是时下(2013/9/8)最新的版本.即从http:/ ...
- J2EE 基础知识积累
1. 面向对象的思维: 1. 有哪些类 那些对象 2. 这些类中,每种类应该具有某种属性和方法 3. 考虑类与类之间应该具有什么样的关系 3. 1. 成员变量可以使用java语言中 ...
- Scala学习笔记--List、ListBuffer
ListBuffer(列表缓冲) ListBuffer类位于 scala.collection.mutable.ListBuffer val buf = new ListBuffer[Int] va ...