GridWebページの変更時にクライアントサイド関数を実行する
可能な使用シナリオ
時々、GridWebページが変更されたときにクライアントサイド関数を実行する必要があります。 Aspose.Cells.GridWebはこの目的のためにOnPageChangeClientFunctionプロパティを提供しています。 このプロパティに、実行したいクライアントサイド関数を設定してください。
GridWebページの変更時にクライアントサイド関数を実行
次のaspxマークアップは、OnPageChangeClientFunctionプロパティの使用方法を説明しています。 このプロパティは、有効にしている場合のみ有効です。 つまり、EnablePaging=“true"が設定されている場合です。 これで、GridWebページを変更するたびに、コンソールに現在のページインデックスを表示するクライアントサイド関数MyOnPageChangeが呼び出されます。
サンプルコード
これは、GridWebでOnPageChangeClientFunction =“MyOnPageChange"プロパティを設定したために実行されるクライアントサイド関数MyOnPageChangeのコードです。 これは完全なaspxページマークアップです。
<%@ 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> |