[英]How to get value from a specific cell in a gridview asp.net c#?
Previously I asked this question... 以前我问过这个问题...
Change the color of a row or record on a gridview on asp.net c#? 更改行的颜色或在asp.net C#的gridview上记录?
I'm trying out one of those answers, however now I stumbled upon a problem... 我正在尝试这些答案之一,但是现在我偶然发现了一个问题...
before assigning a color to the row, first I must make sure that both the field Estado equals to "Pendiente", and that the field Fecha (which is a date) is lower that today's date... 在为行分配颜色之前,首先我必须确保Estado字段等于“ Pendiente”,并且Fecha字段(这是一个日期)低于今天的日期...
I just can't find a way to get those couple of values out of the gridview
我只是找不到一种方法可以从
gridview
获取这两个值
I need to do this for every row, so I'm usin the one that involves RowDataBound
我需要为每一行执行此操作,所以我使用的是涉及
RowDataBound
than you show need to just check the text value of cell of gridrow. 比您显示的只需检查gridrow单元格的文本值。
like in your rowbound if the its BoundColumn
就像在您的行
BoundColumn
如果其BoundColumn
string value = e.Row.Cells[1].Text;//here 1 is you column number
if there is TemplateColumn
and contains control like label than 如果有
TemplateColumn
并包含标签之类的控件,则
string value = (e.Row.FindControl("lableid") as Label).Text;
than write your login. 而不是写您的登录名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.