I have a button search, when the user clicks on the button it retrieves the data from a particular source and binds it to the datalist.
On this event, i need to change the color of a particular column, what column it exactly is will be defiened by the the checkboxes.
So my question is, is there a possibility to change the color of whole the column? Or do i need to do it cell per cell, and how to do that? And if im doing it cell by cell how can i determine is this the right cell of a right column?
Thanks in advance
Update:
I tried the way here was advised, but nothing happend, i dont know does it matter if all the data is in table inside the datalist? It has any effect?
FOUND SOLUTION: The best way to solve that is to add to the td in which you have the data id and the runat="server", this way you can then just in ItemDataBound execute the next code to get the cell:
(e.Item.FindControl("NameOfTheTD") as HtmlTableCell).BgColor = "Green";
Write the below code in the Datalist's ItemCommand
if (e.CommandName == "ThisMonth")
{
System.Drawing.Color colour = System.Drawing.ColorTranslator.FromHtml("#65B3E3");
e.Item.BackColor = colour;
}
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.