http://gcdn.grapecity.com/showtopic-4781.html
- <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Uc_TestReportModelOfSpread_View.ascx.cs"
- Inherits="GNC.Web.UserControls.TDM.TestManage.TestReportModelOfSpread.Uc_TestReportModelOfSpread_View" %>
- <%@ Register Assembly="FarPoint.Web.Spread" Namespace="FarPoint.Web.Spread" TagPrefix="FarPoint" %>
- <script language="javascript" type="text/javascript">
- //清空Spread单元格选定状态
- function ClearSelectionStatus() {
- var spread = document.getElementById('<%=FpSpread1.ClientID %>');
- //获取spread对象
- spread.ClearSelection();
- spread.Update();
- }
- </script>
- <asp:Label ID="lblMessage" CssClass="TDM_ErrorMessage" EnableViewState="False" runat="server" ForeColor="Red"></asp:Label>
- <FarPoint:FpSpread ID="FpSpread1" runat="server" BorderColor="Black" BorderStyle="Solid"
- BorderWidth="1px" Height="200" Width="400">
- <CommandBar BackColor="Control" ButtonFaceColor="Control" ButtonHighlightColor="ControlLightLight"
- ButtonShadowColor="ControlDark">
- </CommandBar>
- <Sheets>
- <FarPoint:SheetView SheetName="Sheet1">
- </FarPoint:SheetView>
- </Sheets>
- </FarPoint:FpSpread>
- <input type="button" id="btnClearSelection" onclick="ClearSelectionStatus()" value="清空" />
复制代码
这是我的代码,当使用“清空”按钮去调用ClearSelectionStatus方法没有问题,想要的功能也可以实现,可我后台调用该方法提示此对象不包含此属性或此方法(方法为ClearSelection),spread.ClearSelection();js错误,通话清空按钮去调用就没有问题。
并且通过var spread = document.getElementById('<%=FpSpread1.ClientID %>');获取到的spread对象不是null,是pread对象。
我后台是这样调用的ScriptManager.RegisterStartupScript(this, this.GetType(), "ClearSelectionStatus", "ClearSelectionStatus();", true);
未命名11111111111111111.JPG
(41.78 KB, 下载次数: 554)
|
|