The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I have created a GridDataBound and it's data source i chose a DataTable .
now , each time I add something to the DataTable it also appears on the GridDataBound . my problem is like this , I wanna change the background of one or more rows , or if that is not possible I wanna change cells colors .
I tried changing the color of the cells like this :
gridDataBound1 [ 1 , 1 ].BackColor = Color.Aqua
but it won't change it ... why is that ?
and how can I change a whole row or at least one cell .
thanks for the help .
ADAdministrator Syncfusion Team November 5, 2003 03:06 PM UTC
There are a couple of KB articles that discuss how to do this.
http://www.syncfusion.com/KB/Grid/Grid_c35c.asp#q560q
http://www.syncfusion.com/KB/Grid/Grid_c35c.asp#q561q
ALAlexNovember 5, 2003 03:29 PM UTC
but how do I call this function , it is an event and not a function . i want a function that recevies a primary key in the DataTable and changes the row color in the GridDataBound .
please help me ...
ADAdministrator Syncfusion Team November 5, 2003 04:14 PM UTC
You cannot call a function and change the color of a row in a GridDataBoundGrid. The reason is that there no properties stored on a row basis in a GridDataBoundGrid.
Instead, you must listened for the PrepareViewStyleInfo event. There, if e.RowIndex and e.ColIndex point to a cell that you want to color, you should set e.Style.BackColor to the desired color. (This way, there is never any color saved for a particular cell or row. It is always provided on demand through this event).
You can use grid.Binder.NameToColIndex to find out the column index for your key column. Attached is a little sample that colors any row whose 'primary key' value is divisible by 4.
ALAlexNovember 5, 2003 07:13 PM UTC
well , ok thanks I will try it tommorow at work and see if it works .