DropDownList为啥总是获取第一项的值???
<asp:DropDownList ID="DropDownListKind" runat="server">
</asp:DropDownList>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
后台代码:
要认真的看上面的代码呦,能找到问题的所在吗。
哈哈!
答案现在揭晓:
都是DropDownListKind.DataValueField = "Kind"; 惹的祸
所以DropDownList绑定后的Value值都相同,所以不出错才怪呢。
因此 DropDownListKind.DataValueField = "Kind";
改成 DropDownListKind.DataValueField = "Name";
DropDownList为啥总是获取第一项的值???的更多相关文章
- 【JSP EL】<c:if> <c:foreach >EL表达式 获取list长度/不用循环,EL在List中直接获取第一项的内容/EL获取Map的键,Map的值
1.EL表达式 获取list长度 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" ...
- c#字典怎么获取第一个键值 List<对象>获取重复项,转成Dictionary<key,List<对象>>
c#字典怎么获取第一个键值 Dictionary<string, int> dictionary = new Dictionary<string, int>(); dictio ...
- jquery操作select下拉框的各种方法,获取选中项的值或文本,根据指定的值或文本选中select的option项等
简介jquery里对select进行各种操作的方法,如联动.取值.根据值或文本来选中指定的select下拉框指定的option选项,读取select选中项的值和文本等. 这一章,站长总结一下jquer ...
- select获取选中项的值与文本
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- WinForms_ListView中获取选中项数据值
string value = listList.SelectedItems[0].SubItems[1].Text;//获取首行listview的值 string va = listList.Sele ...
- AspxTreeList获取选中项的值
在csdn上了发了次帖子,没人回复,只有自己结贴了.http://bbs.csdn.net/topics/390706314?page=1#post-396723432 //通过选中的节点获取用户ID ...
- Json不知道key值情况下获取第一个键值对
JObject jsonData = new JObject(); jsonData.Add("1", "1"); jsonData.Add("2&q ...
- Map使用foreach遍历方式,Map获取第一个键值
List<Map<String, Object>> mapList = new ArrayList<>(); for (Map.Entry<String,O ...
- JS获取DropDownList选择项的值
var dropDownList= document.getElementById("<%=DropDownListID.ClientID %>");//获取DropD ...
随机推荐
- 【Win7激活工具2013版下载】适用于旗舰版、家庭高级版等所有版本32/64位 OEM激活
虽然现在Win8已经发布了,但是身边总是还有一些朋友在用着Win7系统,而近期微软频繁的推送补丁包,导致之前的那些激活都失效了.找了网络上很多工具,之前的那些有的已经不能用了,激活不了,今天就推荐一些 ...
- delphi 实现vip126发邮件
本例是 TSimpleThread , TSimpleList, IdhttpEx 网页模拟(POST)的综合运用. Demo只写了发送,但亦可收取,详见源码. (此源码写于2年前,那时还写得不好,请 ...
- iOS 视图跳转
//跳转 - ( void)present:( id )sender { NSLog ( @"the button,is clicked …" ); // 创建准备跳转的 UIVi ...
- hdu 1210_(逻辑训练)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1210 #include<stdio.h> int main() { int n,t,sum ...
- 在cmd中输入ls命令出现“ls不是内部或外部命令解决
今天在学习sass查看目录遇到cmd输入ls提示不是内部命令 解决方法: 新建一个ls.bat文件 内容为: @echo off dir
- 关于Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
google 给的android的例子里,有用到google APIs,新版本的ADT默认只有Android的SDK,如果运行平台与目标平台不一致会报:Installation error: INST ...
- Nio Client
public class NIOClient { static int SIZE = 2; final static int bufferSize = 500 * 1024; static InetS ...
- malloc 申请得到的内存后,再 free 释放它的时候,操作系统会立即收回那块内存吗?
stackoverflow上的回答: In many malloc/free implementations, free does normally not return the memory to ...
- vs2012C#编程环境设置智能提示
vs2012 智能提示和 显示行号的问题 路径为 菜单里 工具-->选项-->文本编辑器-->C# 如图所示 自动列出成员就是 vs里面的智能提示 行号就会显示所写代码的行 ...
- Performance tool httperf
httperf: A relatively well-known open source utility developed by HP, for Linux operating systems on ...