[英]Performing action on gridview cell click in asp.net C#
I want to perform some action by clicking on the grid view cell. 我想通过单击网格视图单元格执行一些操作。 i know the row clicking and getting the full row data but i am not able to get the particulate cell event. 我知道该行单击并获取完整的行数据,但我无法获得颗粒细胞事件。
as we can see in above grid view, i want to perform action on particulate cell number. 正如我们在上面的网格视图中看到的,我想对颗粒细胞数执行操作。
Thank you 谢谢
add an on RowDataBound
like this 像这样在RowDataBound
上添加
protected void Gridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[1].Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gridview, "Select$" + e.Row.RowIndex);
}
}
you can give cell by its index like this
e.Row.Cells[1]
for cell 1 您可以通过单元格1的e.Row.Cells[1]
这样的索引来指定单元格
you can get any selected
row cell
value like this 您可以像这样获取任何selected
row cell
值
protected void Gridview_SelectedIndexChanged(object sender, EventArgs e)
{
string designation = Gridview.SelectedRow.Cells[0].Text;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.