回复 5楼sdwd_lhq的帖子
查询之后可在服务端调用客户端的JS来实现滚动操作:
- protected void btn_serch_Click(object sender, EventArgs e)
- {
- int x = -1;
- int y = -1;
- FpSpread1.Search(0, txt_serch.Text, false, false, false, false, 0, 0, ref x, ref y);
- if (x >= 0)
- {
- //从x行0列开始总共1行10列被选择
- FpSpread1.ActiveSheetView.SelectionModel.SetSelection(x, 0, 1, 10);
- ClientScript.RegisterStartupScript(this.GetType(), "ScrollTo", "ScrollToRow(5);", true);
- }
- }
复制代码
- <script type="text/javascript" language="javascript">
- var rowindex = 0;
- function ScrollToRow(e) {
- if (e != "" && e != undefined) {
- rowindex = e;
- }
- if (FpSpread1.readyState == "complete") {
- FpSpread1.ScrollTo(rowindex, 0);
- } else if (FpSpread1.readyState == "loading") {
- setTimeout(ScrollToRow, 500);
- }
- }
- </script>
复制代码 |