hello....
ASP.net, C#.
I have a gridview with a crosstab access query.
It is a attendance spreadsheet.
Name, 01 (Sun) 02 (Mon) 03 (Tue) ........ upto Date 15
The data is displaying pretty good, except that I would like to change some colors for:
1) I would like to go thru the headers (since I have not created them) - and check for "Sat" and "Sun" and change the Column color to beige.. (eg)
2) Then, I would like to go thru the rows and see if I have any data in the cells for employees, and if it is, I would like to color code them by each text in that cell.
O - off, V - Vacation, S-sick
so far, I have,
When I uploaded the data to the gridview, I also extract the column headers in a class.
This gives me all the column headers.
--------------------------
----------
----------
public GridViewColumnHeadersList GetGridHeaders(OleDbDataRe
ader dr)
{
GridViewColumnHeadersList gridviewcolumnheaderslist = new GridViewColumnHeadersList(
);
if (DBReader.HasRows == true)
{
for (int i = 1; i <= DBReader.FieldCount-1; i++)
{
if (DBReader.GetName(i) != "Employee Name")
{
gridviewcolumnheaderslist.
Add(new GridViewColumnHeaders(DBRe
ader.GetNa
me(i)));
}
}
}
return gridviewcolumnheaderslist;
}
Then, in my form, I have create RowCreated
--------------------------
----------
----------
-------
protected void GridView1_RowCreated(objec
t sender, System.Web.UI.WebControls.
GridViewRo
wEventArgs
e)
{
ds.goThruGrid(e,GridView1)
;
}
/// I am here now... .need help....
**************************
****
**************************
****
public void goThruGrid(System.Web.UI.W
ebControls
.GridViewR
owEventArg
s e, GridView grd)
{
int x = 0;
string sun = "Sun";
string sat = "Sat";
if (null != grdlist)
{
foreach (GridViewColumnHeaders c in grdlist)
{
x = x + 1;
if (e.Row.RowType == DataControlRowType.Header)
{
foreach (TableCell Tc in e.Row.Cells)
{
if (Tc.Text == c.col_Name)
{
if ((c.col_Name.Substring(4,3
) == sun) || (c.col_Name.Substring(4,3)
== sun))
{
}
}
else
{
}