前台绑定:
<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. Hibernate+Oracle注解式完整实例

    MyEclipse10,新建Web Project,取名hibernate, jar包 1.Cat.java (实体类) package com.hibernate.bean; import java ...

  2. java开发连接Oracle 12c采用PDB遇到问题记录

    今天初次使用java连接Oracle 12c,遇到各种问题,为方便后续查询,在汇总了问题记录及解决方案如下. ORA-28040: No matching authentication protoco ...

  3. C++小项目:directx11图形程序(九):总结

    整篇文章中对于directx11的知识的介绍并不多,我也不知道怎么介绍,也应该说对于directx,它有它自己的部分,比如设备(device),设备上下文(devicecontext),顶点缓存,索引 ...

  4. 手把手教你在ubuntu上安装apache和mysql和php

    1:首先安装apache:打开终端(ctrl+Alt+t), 输入命令:sudo apt-get install apache2即可安装, 安装完后,打开浏览器,在地址栏输入:localhost或者h ...

  5. 进程间通信--pipe

    管道的两种局限性: 历史上,他们是半双工的(即数据只能够在一个方向上流动). 现在某些系统也提供全双工管道,但是为了最佳的移植性,我们决不应该预先假定系统使用此特性 他们只能够在具有公共祖先的进程间使 ...

  6. 使用WebDriverWait类处理等待(sleep)的问题

    用selenium进行web UI的自动化开发时,经常遇到loading需要等待的时候,或者需要验证一个action之后某个dialog是否呈现或者消失.对于这类情况是不建议用sleep(xx)来死等 ...

  7. hibernate整合spring开发的时候遇到的一些小问题

    1 在spring整合hibernate开发的时候,在数据源里面配置show_sql为true,但是在实际查询的时候并没有打印sql语句,正确的解决方案为: 把<prop key="s ...

  8. Visual Studio 2015 Update 1 ISO

    Visual Studio Community 2015 with UPDATE 1___________________________________________English ENU - h ...

  9. mysql免安装版本

    [下载MySQL 5.6.13] 从MySQL官方网站mysql.com找到MySQL Community Server 5.6.13的下载地址为http://dev.mysql.com/downlo ...

  10. TransactionScope 使用记录

    最近使用TransactionScope来进行处理不同数据库的操作问题,当看到这里的时候肯都是在使用或者要使用的吧,关于他的使用网络上一大堆,我在使用的时候遇到了一下的问题,作为记录,可能会对以后使用 ...