RadioButtonList的使用
前台绑定:
<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的使用的更多相关文章
- 初学ReactJS,写了一个RadioButtonList组件
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>React Demo</title> ...
- Jquery 操作CheckBox ,RadioButtonList,DropDownList
Jquery版本2.1.4 CheckBox 1.获取值: $("#chb").prop("checked"); RadioButtonList 1.获取值: ...
- jquery给net里面的RadioButtonList添加选项改变事件
<script type="text/JavaScript" src="../../../JS/jQuery-1.4.1.min.js"></ ...
- RadioButtonList 属性设置
RadioButtonList 属性里有RepeatDirection 设为Horizontal
- js判断radiobuttonlist的选中值显示/隐藏其它模块
<script> $(function () { var SelectVal = $("input[name='rblGJS']:checked").val(); if ...
- DropDownList的使用,RadioButtonList的使用
DropDownList的使用之从后台动态获取值 前端aspx代码如下 <asp:DropDownList ID="DDLTypeID" runat="server ...
- RadioButtonList单选和RequiredFieldValidator验证是否选中
<asp:RadioButtonList ID="Radio2" RepeatDirection="Horizontal" runat="ser ...
- CHtml::radioButtonList
public function getSortList(){ $arr = array(); $arr[0]['id']=0; $arr[0]['name']="否"; $arr[ ...
- RadioButtonList js获取选择的项
<asp:RadioButtonList ID="RadioButtonList1" runat="server"> <asp:ListIte ...
随机推荐
- eclipse 导入工程报错Unable to execute dex: Multiple dex files define Landroid/annotation/SuppressLint
对策: 检查libs 是否有重复加载的.
- 用Window Authentication的方式去连接SQLServer
用Window Authentication的方式去连接SQLServer Connection String: jdbc:sqlserver://${serverName};databaseName ...
- ubuntu的一些操作
1.修改ubuntu的grub启动选择菜单 需要修改到文件为 /boot/grub/grub.cfg 命令: sudo gedit /boot/grub/grub.cfg 修改默认启动项:set de ...
- 作业七:团队项目——Alpha版本冲刺阶段010
今日安排:组内成员讨论 今日进程:组内成员讨论结束,并有明确的解决办法,每个人准备实践
- json字符串返回到js中乱码
Ajax 的post请求值返回到js中时出现中文乱码的情况,但是在action中写入时并未乱码,解决办法在action中写入前,加上这两行: request.setCharacterEncoding( ...
- 学习Excel 十大函数
云课堂视频教程 笔记总结: URL:http://study.163.com/course/courseLearn.htm?courseId=1009026#/learn/video?lessonId ...
- Spark MLlib 之 Naive Bayes
1.前言: Naive Bayes(朴素贝叶斯)是一个简单的多类分类算法,该算法的前提是假设各特征之间是相互独立的.Naive Bayes 训练主要是为每一个特征,在给定的标签的条件下,计算每个特征在 ...
- 浅谈 Struts2 面试题收藏
Struts2面试题 一.工作原理 一个请求在Struts2框架中的处理大概分为以下几个步骤 1 客户端初始化一个指向Servlet容器(例如Tomcat)的请求 2 这个请求经过一系列的过滤器(Fi ...
- eclipse为方法添加注释的快捷键是什么
/** * 登录验证 * @param 传入的vo类 * @return * @throws Exception */这种注释快捷键? 先敲“/”在敲两个**,然后回车
- Three.js基本 Demo
对于新手来说,几个简单的例子非常实用,偶然发现几个不错的Demo,分享给大家! Three.js基本 Demo 1.最基本的Hello World:http://stemkoski.github.io ...