回复 5楼nangcat的帖子
后台代码:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- this.FpSpread1.Sheets.Count = 2;
- }
- protected override void Render(HtmlTextWriter writer)
- {
- Table cmdtb = this.FpSpread1.FindControl("cmdTable") as Table;
- int sheetCount = this.FpSpread1.Sheets.Count;
- for (int i = 0; i < sheetCount; i++)
- {
- cmdtb.Rows[0].Cells[i * 2 + 1].Attributes.Add("onclick", "test(" + i.ToString() + ");" + "document.getElementById('FpSpread1').CallBack('SelectView,"+i.ToString()+"');return false;");
- }
- base.Render(writer);
- }
- }
复制代码
前台代码:
- <script type="text/javascript">
- function test(arg1) {
- alert(arg1);
- }
- </script>
复制代码
"test(" + i.ToString() + ");" 用于传递当期点击Sheet Index 到前台。
"document.getElementById('FpSpread1').CallBack('SelectView,"+i.ToString()+"');return false;"用户切换 Sheet。
为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢 |