我把spread封装到用户控件里面,刚开始打印的时候,可以打印出来数据,但是当我在用户控件上面加了一段JS之后,打印出来的全是空白,请问是什么原因?
下面是JS代码
<script language="javascript" type="text/javascript" id="Card_Script2">
function Card_ActiveCellChanged(event){
var card = document.getElementById("<%=Card.ClientID %>");
var cell = card.GetCellByRowCol(card.ActiveRow,card.ActiveCol);
//var hidden = document.getElementById("HiddenField2");
if(cell.title="aa") {
<%=Page.GetPostBackEventReference(btnEnter)%>
}
}
</script>
<script type="text/javascript">
window.onload = function () {
var card = document.getElementById("<%=Card.ClientID %>");
card.onkeydown = Move;
}
function Move() {
if (event.keyCode == 13) {
var card = document.getElementById("<%=Card.ClientID %>");
var col = card.ActiveCol;
var row = card.ActiveRow;
var colCount = card.GetColCount();
var cell = card.Cells(row, col);
for (var i = 1; i <= colCount; i++) {
var cell2 = card.GetCellByRowCol(row, col + i);
if (cell2.CellType2 != "LabelCellType") {
if (cell.colSpan > 1) {
var cell3 = card.GetCellByRowCol(row, col + i + cell.colSpan - 1);
if (cell3 != null) {
if (cell3.CellType2 == "LabelCellType") {
card.SetActiveCell(row, col + i + cell.colSpan);
}
else {
card.SetActiveCell(row, col + i + cell.colSpan - 1);
}
if (col + 1 == colCount + cell.colSpan) {
card.SetActiveCell(row + 1, 1);
}
}
else {
card.SetActiveCell(row + 1, 1);
}
break;
}
else {
if (col + i < colCount) {
card.SetActiveCell(row, col + i);
}
break;
}
}
}
}
}
</script>
spread 代码
<table style="margin-left: 10px;">
<tr>
<td>
<farpoint:fpspread id="Card" runat="server" bordercolor="Black" borderstyle="Solid"
borderwidth="1px" onprintsheet="Card_PrintSheet" clientautosize="true">
<CommandBar BackColor="Control" ButtonFaceColor="Control" ButtonHighlightColor="ControlLightLight"
ButtonShadowColor="ControlDark">
<Background BackgroundImageUrl="SPREADCLIENTPATH:/img/cbbg.gif"></Background>
</CommandBar>
<Sheets>
<FarPoint:SheetView SheetName="Sheet1">
</FarPoint:SheetView>
</Sheets>
<ClientEvents ActiveCellChanged="Card_ActiveCellChanged" />
</farpoint:fpspread>
</td>
</tr>
</table>
<asp:button id="btnEnter" runat="server" text="Button" style="display: none;" />
<asp:hiddenfield id="HiddenField1" runat="server" />
<asp:hiddenfield id="HiddenField2" runat="server" />
<asp:hiddenfield id="HfAllValue" runat="server" /> |
|