zoukankan
html css js c++ java
gridview取行索引和行绑定
前台添加一模版列,里面添加一个Button
<
asp:TemplateField HeaderText
=
"
测试
"
>
<
ItemTemplate
>
<
asp:Button ID
=
"
Button1
"
CommandName
=
"
btn
"
runat
=
"
server
"
Style
=
"
position: relative
"
Text
=
"
Button
"
/>
</
ItemTemplate
>
</
asp:TemplateField
>
后台
protected
void
gv_Company_RowCommand(
object
sender, GridViewCommandEventArgs
e)
{
if
(e.CommandName
==
"
btn
"
)
{
int
index
=
Convert.ToInt32(e.CommandArgument);
DataKey key
=
this
.gv_Company.DataKeys[index];
string
tt
=
key.Value.ToString();
Response.Write(tt);
}
}
//
行数据绑定
protected
void
gv_Company_RowDataBound(
object
sender, GridViewRowEventArgs e)
{
if
(e.Row.RowType
==
DataControlRowType.DataRow)
{
Button bt
=
new
Button();
bt
=
(Button)e.Row.Cells[
6
].FindControl(
"
Button1
"
);
bt.CommandArgument
=
e.Row.RowIndex.ToString();
}
}
查看全文
相关阅读:
CF1580B Mathematics Curriculum
[机房测试]变异大老鼠
http_缓存
UDP_概述
记录: webAssembly 延申
Event
NetWork_timeLine
基于Typora的Latex代码书写并移植到word中
ZooKeeper学习总结
HBase学习总结
原文地址:https://www.cnblogs.com/xryyforver/p/1508549.html
最新文章
QT中的QFileDialog
QT操作Excel
项目打包
QT中QPushButton
QT中音效
QT中的鼠标穿透事件
QT中封装按钮
QT中的延时函数
Codeforces Global Round 16部分题解
注释与嵌入文档
热门文章
解决数据库一张表中百万条数据
【java基础】访问权限修饰符
近期学习方向摸索
[机房测试]信息拦截
[AGC018C] Coins
CF960H Santa's Gift
「SWTR-05」String
「SWTR-05」Chain
CF1580D Subsequence
[机房测试]学园偶像的盛会
Copyright © 2011-2022 走看看