[]
Sets the backcolor of the cell at the specified row and column.
[JavaScript]
FpSpread1.SetBackColor(row,column,value,noEvent);
row
Integer, row index
column
Integer, column index
value
String, value
noEvent
Boolean, whether to trigger the onDataChanged event
None
This method sets the color of a cell at the specified row and column and triggers the onDataChanged event if specified. If noEvent is true, the method does not trigger an event; otherwise, the method triggers an onDataChanged event. This method does not cause a postback to occur.
This is a sample that contains the method.
On the server side on page load:
FpSpread1.Attributes.Add("onDataChanged", "ProfileSpread()")
On the client side, the script that contains the method would look like this:
<script type="text/javascript">
function ProfileSpread()
{
var szCell = document.all("FpSpread1");
if (szCell.ActiveCol == 0)
{
szCell.Cells(0, 1).SetBackColor("red", true);
alert("Test");
}
}
</script>
This example maps the onDataChanged event and updates the cell backcolor when a value is changed.
<script language="javascript" type="text/javascript">
window.onload = function () {
var spread1 = document.getElementById("<%=FpSpread1.ClientID %>");
// IE
if (spread1.addEventListener) {
// IE9
spread1.addEventListener("DataChanged", dataChanged, false);
} else {
// Other versions of IE and IE9 quirks mode (no doctype set)
spread1.onDataChanged = dataChanged;
}
}
function dataChanged() {
var spread1 = document.getElementById("<%=FpSpread1.ClientID %>")
spread1.Cells(FpSpread1.ActiveRow, 2).SetBackColor("red", true);
}
</script>