Dear Sir,
I have totally 25 Columns in a WebDataGrid, here i need to change the back color of the Particular Columns
for example,
Column 2 to Column 7 in Yellow Color Back Ground
Column 8 to Column 13 in blue Color background
Column 14 to Column 19 in Grey Color BackGround
Column 20 to Column 25 in Alice Blue backGround
I already note the EditingCore in the Grid Controls but it was not reference in the parental Control of web.ui.gridcontrols.....
Kindly Help me....
Thanks for your reply.
and I done it using Css File and insert the css in the Bounddatafield property for every Columns....
Thanks.
Manoj Kumar
Hello Kumar,
I suggest that you do this on the client using the Initialize event of the grid. You can get all <td> elements that the column consists of using jQuery and apply them inline style as follows:
On the server you can get the columns you need and add css class like this:
However the styles you add in this classes will be overwritten by the default ones and in order to work you will need to specify them as !important:
.yellow {
background-color: yellow !important;
}
, which is not a recommended approach.
I prepared a sample demonstrating both scenarios (My grid has less columns). Please let me know if you have any further questions on the matter.