MobilePage.ActiveForm プロパティ
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)

<BindableAttribute(False)> _ Public Property ActiveForm As Form
Dim instance As MobilePage Dim value As Form value = instance.ActiveForm instance.ActiveForm = value
[BindableAttribute(false)] public: property Form^ ActiveForm { Form^ get (); void set (Form^ value); }
/** @property */ public Form get_ActiveForm () /** @property */ public void set_ActiveForm (Form value)
ページ上で現在アクティブなフォーム。

ページが最初にレンダリングされると、ページ内の最初のフォームが自動的にアクティブになります。以降のポストバックでは、このプロパティをプログラムから設定するか、ユーザーが Link コントロールを通じて移動すると、他のフォームがアクティブになります。

Form コントロールの ActiveForm プロパティを使用する方法の例を次に示します。現在のモバイル デバイスでコントロールにアクセス キーを使用できる場合、フォームを送信するアクセス キーがボタンに表示されます。
![]() |
---|
次のコード サンプルはシングルファイル コード モデルを使用しており、分離コード ファイルに直接コピーされた場合は正常に動作しない可能性があります。このコード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。詳細については、「ASP.NET Web ページのコード モデル」を参照してください。 |
<%@ Page Language="VB" Inherits="System.Web.UI.MobileControls.MobilePage" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <%@ Import Namespace="System.Web.Mobile" %> <script runat="server"> Private Sub Command_OnClick(ByVal sender As Object, ByVal e As EventArgs) ' Display the other form If ActiveForm.ID = "Form1" Then ActiveForm = Form2 Else ActiveForm = Form1 End If End Sub Public Function isAccessKey(ByVal caps As MobileCapabilities, _ ByVal optValue As String) As Boolean ' Determine if the browser is not a Web crawler ' and can use access keys If Not caps.Crawler AndAlso caps.SupportsAccesskeyAttribute Then Return True End If Return False End Function </script> <html > <body> <mobile:Form runat="server" id="Form1" > <mobile:Label ID="Label1" Runat="server">This is Form1</mobile:Label> <mobile:Command id="cmd1" runat="server" Text="No AccessKey" onClick="Command_OnClick"> <DeviceSpecific> <Choice Filter="isAccessKey" Text="AccessKey is 1"/> </DeviceSpecific> </mobile:Command> <mobile:Label id="Label2" runat="server" /> </mobile:Form> <mobile:Form ID="Form2" Runat="server"> <mobile:Label ID="Label3" Runat="server">This is Form2</mobile:Label> <mobile:Command id="cmd2" runat="server" text="Back to Form1" onClick="Command_OnClick"> <DeviceSpecific> <Choice Filter="isAccessKey" Text="1 is AccessKey" AccessKey="1" /> </DeviceSpecific> </mobile:Command> </mobile:Form> </body> </html>
<%@ Page Language="C#" Inherits="System.Web.UI.MobileControls.MobilePage" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <%@ Import Namespace="System.Web.Mobile" %> <script runat="server"> private void Command_OnClick(object sender, EventArgs e) { // Display the other form if (ActiveForm.ID == "Form1") ActiveForm = Form2; else ActiveForm = Form1; } public bool isAccessKey(MobileCapabilities caps, string optValue) { // Determine if the browser is not a Web crawler // and can use access keys if (!caps.Crawler && caps.SupportsAccesskeyAttribute) return true; return false; } </script> <html > <body> <mobile:Form runat="server" id="Form1" > <mobile:Label Runat="server">This is Form1</mobile:Label> <mobile:Command id="cmd1" runat="server" Text="No AccessKey" onClick="Command_OnClick"> <DeviceSpecific> <Choice Filter="isAccessKey" Text="AccessKey is 1"/> </DeviceSpecific> </mobile:Command> <mobile:Label id="Label1" runat="server" /> </mobile:Form> <mobile:Form ID="Form2" Runat="server"> <mobile:Label Runat="server">This is Form2</mobile:Label> <mobile:Command id="cmd2" runat="server" text="Back to Form1" onClick="Command_OnClick"> <DeviceSpecific> <Choice Filter="isAccessKey" Text="1 is AccessKey" AccessKey="1" /> </DeviceSpecific> </mobile:Command> </mobile:Form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMobilePage.ActiveForm プロパティを検索する場合は、下記のリンクをクリックしてください。

- MobilePage.ActiveForm プロパティのページへのリンク