加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

[ASP.net] GridView抓各Field值的方法

发布时间:2020-12-16 09:28:17 所属栏目:asp.Net 来源:网络整理
导读:[ASP.net] GridView抓各Field值的方法 BoundField?? e.Row.Cells[栏索引].Text CheckBoxField CheckBox chk = (CheckBox)e.Row.Cells[栏索引].Controls[0];? ?????????????? chk.Text = "Hello World!!"; HyperLinkField HyperLink lnk = (HyperLink)e.Row.C

[ASP.net] GridView抓各Field值的方法


BoundField??

e.Row.Cells[栏索引].Text

CheckBoxField

CheckBox chk = (CheckBox)e.Row.Cells[栏索引].Controls[0];?
?????????????? chk.Text = "Hello World!!";

HyperLinkField

HyperLink lnk = (HyperLink)e.Row.Cells[栏索引].Controls[0];?
??????????????? lnk.Text = "Hello World!!";

ImageField

Image img = (Image)e.Row.Cells[栏索引].Controls[0];?
????????? img.ImageUrl="";

ButtonField

Button btn = (Button)e.Row.Cells[栏索引].Controls[0];?
????????? btn.Text="Hello World!!";

CommandField

要视ButtonType(Button、Link、Image)决定
以Link为例:
LinkButton lnkbtn = (LinkButton)e.Row.Cells[栏索引].Controls[0];
??????????????? lnkbtn.Text = "Hello World!!";

TemplateField

(控件类型)e.Row.FindControl("控件id");

from MSDN论坛:GridView 取值几个问题

原文:大专栏 ?[ASP.net] GridView抓各Field值的方法

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读