客户端没有直接的方法来取ActiveSheetViewIndex,可以通过以下代码来完成:
服务端代码:
- protected override void Render(HtmlTextWriter writer)
- {
- WebControl c = FpSpread1.FindControl("viewport") as WebControl;
- c.Attributes.Add("ActiveSheet", FpSpread1.ActiveSheetViewIndex.ToString());
- base.Render(writer);
- }
复制代码
客户端代码:
- <script language="javascript" type="text/javascript">
- var ss;
- function window.onload() {
- ss = document.getElementById("FpSpread1");
- ss.onCallBackStopped = MyFunction;
- }
- function MyFunction() {
- var viewport;
- viewport = document.getElementById("FpSpread1_viewport");
- alert(viewport.getAttribute("ActiveSheet"));
- }
- </script>
复制代码 |