简体   繁体   English

如何从asp.net C#的GridView中的特定单元获取价值?

[英]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.

相关问题 如何从ASP.NET C#中的GridView获取单击的超链接行相邻单元格值 - How to get clicked hyperlink row adjacent cell value from GridView in ASP.NET C# 从 GridView asp.net c# 中选择一个单元格值 - Select a cell value from GridView asp.net c# 如何从asp.net C#Web窗体应用程序中的GridView中将selectedrow单元格值获取到电子邮件正文中? - How to get selectedrow cell value from a gridview into the body of an email in my asp.net c# web forms application? 使用C#在自定义方法ASP.NET中从GridView中获取单元格值 - Fetching Cell Value From GridView in Custom Method ASP.NET using C# 从ASP.NET GridView单元获取值 - Get Value from ASP.NET GridView cell 如何获取单元格的值指定GridView ASP.NET - How to get the value of a cell specifies the GridView ASP.NET 如何在C#ASP.NET中使用GridView_RowCommand事件从GridView获取图像 - How to get image from GridView using GridView_RowCommand event in c# ASP.NET 如何在ASP.NET C#的Gridview中获取和显示特定值 - How to obtain and display specific value in Gridview on ASP.NET C# 使用asp.net C#中的javascript从具有单选按钮的gridview列中获取值 - Get value from gridview column that has radio button using javascript in asp.net c# 尝试从C#(ASP.NET gridview)中的文本框获取文本值时出错 - Error while trying to get text value from textbox in C# (ASP.NET gridview)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM