前台绑定:
<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. ios 重签名

    http://stackoverflow.com/questions/6569120/resigning-an-application-outside-xcode #!/bin/sh TEMPDIR= ...

  2. Eclipse中怎么安装TestNG单元测试框架

    在进行使用的eclipse的进行开发的代码中,必然就会需要进行单元测试,在单元测试的情况提供较多的框架单元测试,例如使用junit单元测试,而在国外进行开发较好的单元测试,提供了较好的测试的报告,ju ...

  3. jQuery LigerUI V1.2.3 (包括API和全部源码) 发布

    前言 这次版本主要是增加了Panel和Portal组件,并增加了一套皮肤,并解决了部分兼容性的问题,添加了几个功能点. 欢迎使用反馈. 相关链接 API:         http://api.lig ...

  4. 分析自定义view的实现过程-实现雪花飞舞效果(转载有改动)

    声明:本文源码出自实现雪花飞舞效果(有改动)主要通过这篇文来分析自定义view的实现过程. 没事时,比较喜欢上网看看一些新的东西,泡在网上的日子就是一个很不错的网站. 下面开始了,哈哈.^_^ 大家都 ...

  5. selenium+python+eclipse开发中遇到的问题

    1.中文编码问题 报错提示:SyntaxError: Non-ASCII character '\xba' in file D:\autotest\PythonCase\src\selenium\te ...

  6. C++多线程1

    一个多线程的实例 #include "stdafx.h" #include <windows.h> DWORD __stdcall Func(LPVOID pm) { ...

  7. 使用ISO文件安装Linux

    一. 准备知识 1. ISO文件 我们普遍使用的ISO文件是指包含着整个CD-ROM(ISO-9660 文件系统)内容的 映象, 是整个碟片从0扇区到最后一个扇区的完整复制,经常被用来在网络上传输 对 ...

  8. if 判断中出现逗号

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

  9. c/c++面试题(7)零碎知识总结

    1.变量的声明和定义有什么区别? 声明:变量的声明做了两件事情 a.告诉编译器这个变量已经匹配到一块内存上了,下面的代码用到的变量或对象是在别处定义的. 声明可以出现很多次. b.告诉编译器这个变量名 ...

  10. EasyUI加载树控件自动展开所有目录

    在这里如何加载树控件就不在熬述,在加载树控件后,树的节点全部展开,要在OnLoadSuccess事件中写代码: