且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

根据c#中的字段值更改gridview中的行颜色

更新时间:2023-02-12 09:46:05

我相信你要求的是ASP.NET Grid View。值是否会自动更新?如果是,您可以尝试通过在网格视图中使用条件绑定来实现此目的。



ASP.NET GridView提供了使用条件绑定表达式的灵活性,我们可以在绑定表达式中使用某些条件。取决于表达式的评估值,ASP.NET GridView将在页面上呈现内容。



使用ASP.NET GridView进行条件绑定表达式 [ ^ ]



在您的情况下,您可以使用字段检查值并为您的颜色应用一些颜色网格根据需要。



希望这对你有帮助。
I believe you are asking for ASP.NET Grid View . Are the values getting updated automatically ? If yes, You can try to achieve this by using conditional Binding in grid View.

ASP.NET GridView provides the flexibility to use conditional binding expression where we can use some condition with bind expression. Depends on the evaluation value of the expression, ASP.NET GridView will render the content on page.

Conditional Binding Expression with ASP.NET GridView [^]

In your case, you can check the value with the field and apply some color to your grid as needed.

Hope this will help you.