简体   繁体   English

如何从 GridView 在单元格内绘制矩形,我使用 webforms c#

[英]How can draw a rectangle inside a cell from GridView, I using webforms c#

The idea is to change the name of the color in the color column for a rectangle with that color, filling the gridview with information stored in the database.这个想法是更改颜色列中颜色名称,用于具有该颜色的矩形,使用存储在数据库中的信息填充网格视图。

I need to do that column change for each row.我需要为每一行做那个列更改。

在此处输入图片说明

You can use the OnRowDataBound event of the gridview to change the contents of the cells programmatically.您可以使用 gridview 的 OnRowDataBound 事件以编程方式更改单元格的内容。

Just at a quick google I found this tutorial with an example of making a visual change to a cell based on data in the row: http://www.tutorialspanel.com/rowdatabound-event-gridview-asp-net/ "Example 1: highlight the row in red if salary is equal or above $10.000" is conceptually similar to what you're trying to do I think.只是在一个快速的谷歌我发现这个教程有一个例子,根据行中的数据对单元格进行视觉更改: http : //www.tutorialspanel.com/rowdatabound-event-gridview-asp-net/ “示例 1 :如果薪水等于或高于 10.000 美元,则以红色突出显示该行”在概念上与我认为的您尝试做的类似。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM