I am using a infragistics component called webdatagrid, inside which row I have got a user control with 48 divs inside, I am making a day scheduler for a company, now after I find the component, I want to check the background color of which of the 48 divs...if white its normal, if gray it means that person is working. so the user control called segments I have this code:
<style type="text/css">
.divttt
{
background-color:#fff;
width:30px;height:32px;
float:left;
border-bottom:solid 1px #C0C0C0 ;
border-top:solid 1px #C0C0C0 ;
border-left:solid 1px #C0C0C0
-moz-border-radius: 5px; /* Firefox */
-webkit-border-radius: 5px; /* Safari, Chrome */
border-radius: 5px; /* universal */
}
.divtoleft
{
width:30px;
height:32px;
float:left;
}
</style>
<div runat="server" class="divtoleft"> </div>
<div id="div1" runat="server" class="divttt">
</div>
<div id="div2" runat="server" class="divttt">
</div>
<div id="div3" runat="server" class="divttt">
</div>
<div id="div4" runat="server" class="divttt">
</div>
<div id="div5" runat="server" class="divttt">
...and continues up to the div48... when the page load all divs are white, then user select which person is working and how many hours, by changing the color to gray. when the user press save I want to see what is the color of the div...
String[] _arrHoras = new String[] { "00:00", "00:30", "01:00", "01:30", "02:00",
"02:30", "03:00", "03:30", "04:00", "04:30",
"05:00", "05:30", "06:00", "06:30", "07:00",
"07:30", "08:00", "08:30", "09:00", "09:30",
"10:00", "10:30", "11:00", "11:30", "12:00",
"12:30", "13:00", "13:30", "14:00", "14:30",
"15:00", "15:30", "16:00", "16:30", "17:00",
"17:30", "18:00", "18:30", "19:00", "19:30",
"20:00", "20:30", "21:00", "21:30", "22:00",
"22:30", "23:00", "23:30", "24:00" };
public string[] getHorasIniciais()
{
int branco = 0;
int preto = 0;
int posarr = 0;
string[] arrHi= new string[] {""};
for (int pos = 0; pos < 48; pos++)
{
string sControlId = "div" + (pos + 1);
Control cControlDiv = FindControl(sControlId);
HtmlGenericControl dDiv = (HtmlGenericControl)cControlDiv;
string t="";
div1.Attributes["background-color"] = t;<--the problem is here...
//if (color.Equals("#909090") == true || color.Equals("rgb(144, 144, 144)") == true)
//{
// if (preto == 0)
// {
// arrHi.SetValue(_arrHoras[pos], posarr);
// posarr++;
// preto = 1;
// }
// if (pos > 47)
// {
// preto = 0;
// arrHi.SetValue(_arrHoras[pos], posarr);
// }
//}
//else {
// if (preto == 1)
// {
// preto = 0;
// }
//}
}
return arrHi;
}
what this code does is to check all of the 48 divs and check the background color, if is white do nothing if is grey, it puts the correspondent time of that block on the array arrHi. The problem is that I can't get the value of background color and compare it...