GridView设置多个DatakeyNames
1.aspx页面GridView直接绑定DataKeyNames
aspx设置:
<asp:GridView ID="grvGrid" runat="server" DataKeyNames="Id,Time"></asp:GridView>
aspx.cs获取:
protected void grvGrid_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
string id = grvGrid.DataKeys[e.NewSelectedIndex][].ToString();
string time=grvGrid.DataKeys[e.NewSelectedIndex]["Time"].ToString();
}
2.GridView初始化时绑定DataKeyNames
初始化DataKeyNames时: GridView1.DataKeyNames=Gridview1.DataKeyNames = new string[] { "PositionID", "DepartmentID" };\
获取:
protected void Gridview1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string positionID = Gridview1.DataKeys[e.RowIndex]["PositionID"].ToString();
}
GridView设置多个DatakeyNames的更多相关文章
- 基于BaseAdapter的GridView设置ImageView大小
基于BaseAdapter的GridView设置ImageView大小 网上找了好多,都是基于SimpleAdapter的,本身在Item.xml中就对ImageView设置了id,而基于BaseAd ...
- 024. asp.net中第一次使用GridView (设置鼠标经过时更换背景色)
1. 前端HTML代码 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Inde ...
- DevExpress的GridView设置特定行的样式
GridView控件绑定事件: gridView_SampleData.CustomDrawCell += gridView_SampleData_CustomDrawCell; 根据自定义逻辑来改变 ...
- GridView 设置背景透明以及Item的点击动画
//将点击时的背景色设置为透明 gridView.setSelector(new ColorDrawable(Color.TRANSPARENT)); 此时点击GridView的每个Item就不会出现 ...
- GridView设置焦点到Cell
/// <summary> /// 设置焦点到Cell /// </summary> /// <param name="view"></p ...
- c#dev gridview 设置隔行换色等
1:禁止gridview编辑 2:隔行换色 介绍一些常用的gridcontrol设置. 1.设置隔行变色.首先设置显示隔行变色,步骤:OptionsView-->EnableAppearance ...
- ASP.NET的gridview设置数据格式(DataFormatString="{}") 2011年04月08日 16:26:00 阅读数:5318 标签: asp.net datagrid integer asp date strin
select convert(numeric(8,2),round(UnTaxAmount,2))as UnTaxAmount from View_SaleVoiceselect cast(UnT ...
- 为Android GridView 设置行背景
经常有这样的需求,你的功能图标要像一个个物品,摆放在书架上,像这样: 我的思路比较简单,重载GridView,在他绘制子视图前,先把背景绘制完成 1 2 3 4 5 6 7 8 9 10 11 12 ...
- Android GridView设置行数
普通的做法是设置一个高度,然后里面能显示出来几行就是几行,如果里面的内容高度变了,就需要重新调整高度来适配. 观察了一下它的onMeasure @Override protected void onM ...
随机推荐
- map端join
package my.hadoop.hdfs.mapreduceJoin; import java.io.BufferedReader; import java.io.FileInputStream; ...
- SharePoint 2013的100个新特性 免费电子书下载
简介:这本电子书对SharePoint 2013的100个新特性和改进的功能提供了一个简短的说明,这些功能分为以下几类: 1. SharePoint 2013内容管理 2. SharePoint 20 ...
- python学习 05 函数switch功能
1.python没有switch功能,利用字典实现 如果用if else,可行但是效率不高
- BlockingQueue的使用 http://www.cnblogs.com/liuling/p/2013-8-20-01.html
BlockingQueue的使用 本例介绍一个特殊的队列:BlockingQueue,如果BlockQueue 是空的,从BlockingQueue取东西的操作将会被阻断进入等待状态,直到Blocki ...
- linux授权某个用户对某个目录有读写的权限
针对特定的某一个用户设置文件或目录权限,用setfacl. 首先打开文件系统的acl功能,在挂载参数添加cal,再保存退出,比如/home分区: vim /etc/fstab /dev/sda2 /h ...
- SQL SERVER 2008查看sql执行的时间
set statistics profile onset statistics io onset statistics time ongo<这里写上你的语句...>goset statis ...
- (比赛)B - 棋盘问题(dfs)
B - 棋盘问题 Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %llu Practice POJ ...
- fedora找开ftpd服务器并以root登陆
工作原因需要在federal中弄个vsftpd再用root去登陆(我知道这样不太安全) 确认系统的版本 [root@localhost ~]# uname -a Linux localhost.loc ...
- maven filters 和 resource
1 filter 1.1 用途 对多个配置文件进行选择. 1.2 选择的依据 1.3 使用的方式 第一,在<resource>标签下面加<filtering>标签,并且< ...
- Python读属性文件
# coding:utf-8 class Properties: def __init__(self, file_name): self.file_name = file_name self.prop ...