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 ...
随机推荐
- AngularJs练习Demo1
@{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport&quo ...
- 在App中混合HTML5开发App如何实现的。在App中使用HTML5的优缺点是什么?
参考答案: 在iOS中,通常是通常UIWebView来实现,当然在iOS8以后可以使用WKWebView来实现.有以下几种实现方法: 通过实现UIWebView的代理方法来拦截,判断scheme是否是 ...
- jQuery和DOM对象
html示例 <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset=" ...
- C语言中的memset函数和数组指针
代码: #include <iostream> #include <cstring> using namespace std; int main(){ ] = {}; mems ...
- NDK编译Python2.7.5
[背景] 网上有一些ndk编译python的做法,但按照教程做总是不成功,可能是环境版本不一样,导致很多地方的配置都不成功. 网上的教程大多只有做法,没有解释,即使按照教程编译成功,很多细节都不知道为 ...
- No2_5.类的高级特性_Java学习笔记_抽象类和成员内部类
一.抽象类1.所谓抽象类,只声明方法的存在而不去实现它的类:2.抽象类不能被实例化,即不能实现其对象:3.abstract class 类名{ 类体 }4.包含一个或多个抽象方法的类必须声明成抽象类: ...
- 小安,今天学会了MySQL中查询时间的方法哦
- 移动WEB开发常用技巧
Meta设置 <!-- 设备宽度.禁止缩放 --> <meta name="viewport" content="width=device-width, ...
- Double Strings Solved Problem code: DOUBLE
# Fuking silly, OTZ.... import sys def main(): n = int(raw_input()) for num in sys.stdin: if int(num ...
- python文件批量改名
python对文件进行批量改名用到的是os模块中的listdir方法和rename方法. os.listdir(dir) :获取指定目录下的所有子目录和文件名 os.rename(原文件名,新文件名 ...