GridWebのページ変更時にクライアントサイド関数を実行する
Contents
[
Hide
]
考えられる使用シナリオ
GridWeb ページが変更されたときに、クライアント側の関数を実行する必要がある場合があります。 Aspose.Cells.GridWeb は、この目的のために OnPageChangeClientFunction プロパティを提供します。実行したいクライアント側関数でこのプロパティを設定してください。
GridWebのページ変更時にクライアントサイド関数を実行する
次の aspx マークアップは、OnPageChangeClientFunction プロパティを使用する方法を説明しています。 MyOnPageChange という名前のクライアント側関数でプロパティを設定します。このプロパティは、ページングを有効にしている場合、つまり EnablePaging=“true” の場合にのみ有効です。これで、GridWeb ページを変更するたびに、クライアント側関数 MyOnPageChange が呼び出され、現在のページ インデックス上でコンソールこのスクリーンショットに示すように。
サンプルコード
GridWebでOnPageChangeClientFunction=“MyOnPageChange"プロパティを設定したことにより実行されるクライアント側関数MyOnPageChangeのコードです。これは完全な aspx ページ マークアップです。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CallClientsideScriptforGridWeb.aspx.cs" Inherits="Aspose.Cells.GridWeb.Examples.CSharp.GridWebBasics.CallClientsideScriptforGridWeb" %> | |
<%@ Register TagPrefix="acw" Namespace="Aspose.Cells.GridWeb" Assembly="Aspose.Cells.GridWeb" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title>Test GridWeb</title> | |
<script type="text/javascript" > | |
function MyOnPageChange(index) { | |
console.log("current page is:" + index); | |
} | |
</script> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<div> | |
<b>GridWeb Version:  </b> | |
<asp:Label ID="lblVersion" runat="server" Text="Label"></asp:Label> | |
<br /> | |
</div> | |
<acw:GridWeb ID="gridweb" | |
runat="server" XhtmlMode="True" | |
Height="504px" Width="1119px" EnablePaging="true" | |
OnPageChangeClientFunction ="MyOnPageChange"> | |
</acw:GridWeb> | |
</div> | |
</form> | |
</body> | |
</html> |