如何在GridView中找到控件 [英] how to find control in gridview

查看:81
本文介绍了如何在GridView中找到控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Gridview中查找控件.我们可以从findcontrol中获取它吗..

how to find control inside the Gridview.Can we take it from findcontrol..

推荐答案

在rowdatabound事件中,您可以像
这样访问
e.row.findcontrol(您要查找的控件ID");


如果要在行命令中查找,则

如果单击了网格中的链接按钮,则

GridViewRow row =(GridViewRow)((((LinkBut​​ton)e.CommandSource).NamingContainer);
in rowdatabound event you can access this like

e.row.findcontrol("id of control you want to find");


if in row command u want to find then

if linkbutton in your grid is clicked then

GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);


foreach (GridViewRow row in gridview.Rows)
{
RadioButton rbn=new RadioButton();
 
rbn=(RadioButton)row.findcontrol("radiobutton id");
//place your code after finding control
}


转到此链接
Gridview
go to this link
Gridview


这篇关于如何在GridView中找到控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆