前台绑定:
<asp:RadioButtonList ID="hlBatchYuJi" runat="server" RepeatColumns="1" CellPadding="1" CellSpacing="1">
</asp:RadioButtonList>

  

js判断选中

 var vRbtid = document.getElementById("hlBatchYuJi");
var vRbtidList = vRbtid.getElementsByTagName("INPUT"); //得到所有radio
for (var i = 0; i < vRbtidList.length; i++) {
if (vRbtidList[i].checked) {
BatchText = vRbtid.cells[i].innerText; //获取绑定的text值
Batchvalue = vRbtidList[i].value; //获取绑定的value值
}
}
if (BatchText == "") {
alert("请选择育雏批次!");
return;
}

  

cs文件后台绑定

 LstBatch = BatchDB.Data.Where(o => o.EnID == UserInfo.EnId && LstChuJIIDs.Contains(o.FarmID) && !LstYiSheBatchID.Contains(o.ID)).ToList();
hlBatchYuJi.DataSource = LstBatch;
hlBatchYuJi.DataTextField = "BatchNo";
hlBatchYuJi.DataValueField = "ID";
hlBatchYuJi.DataBind();

赋值初值,选中的 

var Info = YISheDB.Data.ToInfo(reqID);//根据ID获取数据
hlBatchYuJi.Items.Insert(0, new ListItem(Info.BatchNo, Info.BatchID.ToString())); //插入新的值
hlBatchYuJi.SelectedIndex = 0; foreach (ListItem item in hlFarmJi.Items) //循环判断选中
{
if (item.Value.ConvertType(0) == Info.FarmID)
{
item.Selected = true;
break;
}
}

  

 

RadioButtonList的使用的更多相关文章

  1. 初学ReactJS,写了一个RadioButtonList组件

     1 <!DOCTYPE html>  2 <html>  3 <head>  4     <title>React Demo</title> ...

  2. Jquery 操作CheckBox ,RadioButtonList,DropDownList

    Jquery版本2.1.4 CheckBox 1.获取值: $("#chb").prop("checked"); RadioButtonList 1.获取值: ...

  3. jquery给net里面的RadioButtonList添加选项改变事件

    <script type="text/JavaScript" src="../../../JS/jQuery-1.4.1.min.js"></ ...

  4. RadioButtonList 属性设置

    RadioButtonList 属性里有RepeatDirection 设为Horizontal

  5. js判断radiobuttonlist的选中值显示/隐藏其它模块

    <script> $(function () { var SelectVal = $("input[name='rblGJS']:checked").val(); if ...

  6. DropDownList的使用,RadioButtonList的使用

    DropDownList的使用之从后台动态获取值 前端aspx代码如下 <asp:DropDownList ID="DDLTypeID" runat="server ...

  7. RadioButtonList单选和RequiredFieldValidator验证是否选中

    <asp:RadioButtonList ID="Radio2" RepeatDirection="Horizontal" runat="ser ...

  8. CHtml::radioButtonList

    public function getSortList(){ $arr = array(); $arr[0]['id']=0; $arr[0]['name']="否"; $arr[ ...

  9. RadioButtonList js获取选择的项

    <asp:RadioButtonList ID="RadioButtonList1" runat="server"> <asp:ListIte ...

随机推荐

  1. WordPress程序伪静态规则(Nginx/Apache)及二级目录规则

    在众多CMS程序中,我们使用WORDPRESS还是比较多的,不仅仅是安全度较好,二来在于插件和主题很多,即便对于不会建站技术的用户也很简单的就可以搭建属于自己的网站项目.对于网站我们肯定是需要让有用户 ...

  2. 用ant组建测试框架

    有时候由于公司网络或其它原因,无法采用maven,这时ant是一个比较理想的选择.以下是以ant为例,搭建一个测试框架 项目结构如下图: build.properties代码如下: # The sou ...

  3. jQuery--事件总结

    标准的绑定: bind(type,[,data],fn)==>第一个参数是事件类型 第二个可选参数作为event.data 传递给事件对象的额外数据对象 第三个参数为用来绑定的处理函数 简写绑定 ...

  4. eap-peap/mschapv2

    eap-peap/mschapv2       文件路径 用途 示例 备注 #gedit /usr/local/etc/raddb/sites-available/default #gedit /us ...

  5. [make]makefile使用积累

    [注]:文中所指手册皆为GNU make Version 4.1 1.make的一般特性 1.1.Makefiles的构成 Makefiles包含五种元素: 显式规则(explicit rules), ...

  6. js操作table

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  7. Longest Substring Without Repeating Characters(Difficulty: Medium)

    题目: Given a string, find the length of the longest substring without repeating characters. Examples: ...

  8. 项目组J2ee程序员的标志,你中招没 转载+评论

    原文在此 校园级别的程序员的标志: 代码中最多的是嵌套if(null == xxx),还要告诉你,null必须写在前面,我靠. 防止把==写成=,c语言时代常犯的错误.由于null不能做左值,在写=的 ...

  9. LCD相关知识点

    1.LCD即液晶显示器,控制原理是控制其中的电子枪,在n行*n列的屏幕上投射不同颜色从而形成图像 2.编程步骤: ①打开LCD背光将LCD背光对应的GPIO设置为禁止上拉(GPxUP相应位写入1),选 ...

  10. iOS技术博客(文摘)链接地址

      objc系列译文(5.1):认识 TextKit 手把手教你配置苹果APNS推送服务 如何使用iOS Addressbook UIApplication深入研究 GCD倒计时 那些不能错过的Xco ...