C
Chico
Hi,
I have an ASP page that was built using MS Visual InterDev. The
original programmer used the MS Visual InterDev DataGrid control to
render his recordset. What I need to do is to change one of the cell
colors based on a database value. Right now the code looks like this:
function _Grid1_ctor()
{
CreateDataGrid('Grid1',_initGrid1);
}
function _initGrid1()
{
if (Session("HaveFoodGroup") == true)
{
Grid1.colHeader[1] = '"Food Group"';
Grid1.colAttributes[1] = set_cell_color();
Grid1.colData[1] = 'get_foodgroup()';
}
}
function set_cell_color()
{
var stemp = Recordset1.fields.getValue("foodGroup");
var cellColor;
if (stemp == "Meats")
cellColor = ' bgcolor="Red"';
if (stemp == "Dairy")
cellColor = 'bgcolor="White";
return stemp;
}
function get_foodgroup()
{
var stemp = Recordset1.fields.getValue("foodGroup");
return stemp;
}
}
My problem is that when the page is rendered the background color of
all the cells is red. This is because the last record in my recordset
is a Meat foodgroup. However, Grid.colData[1] is properly displaying
the foodgroups.
Can someone tell me what's going on?
Thanks
I have an ASP page that was built using MS Visual InterDev. The
original programmer used the MS Visual InterDev DataGrid control to
render his recordset. What I need to do is to change one of the cell
colors based on a database value. Right now the code looks like this:
function _Grid1_ctor()
{
CreateDataGrid('Grid1',_initGrid1);
}
function _initGrid1()
{
if (Session("HaveFoodGroup") == true)
{
Grid1.colHeader[1] = '"Food Group"';
Grid1.colAttributes[1] = set_cell_color();
Grid1.colData[1] = 'get_foodgroup()';
}
}
function set_cell_color()
{
var stemp = Recordset1.fields.getValue("foodGroup");
var cellColor;
if (stemp == "Meats")
cellColor = ' bgcolor="Red"';
if (stemp == "Dairy")
cellColor = 'bgcolor="White";
return stemp;
}
function get_foodgroup()
{
var stemp = Recordset1.fields.getValue("foodGroup");
return stemp;
}
}
My problem is that when the page is rendered the background color of
all the cells is red. This is because the last record in my recordset
is a Meat foodgroup. However, Grid.colData[1] is properly displaying
the foodgroups.
Can someone tell me what's going on?
Thanks