简体   繁体   中英

how to set gridview Cell back ground color in asp.net

I have 20 rows and 10 column data in Gridview.
I have to set particular cell back ground color Gray like [1 row][1 col],[3 row][1 col].
I have written this line of

code.grdsellthru.Rows[3].BackColor = System.Drawing.Color.Gray;  

but color is applying total row.
I need to apply only 3 rd row 1 column.

color is applying total row.I need to apply only 3 rd row 1 column

You need to specify Cell along with the Row like:

grdsellthru.Rows[3].Cells[1].BackColor = System.Drawing.Color.Gray;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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