LoginName.FormatString プロパティ
アセンブリ: System.Web (system.web.dll 内)
構文
Dim instance As LoginName Dim value As String value = instance.FormatString instance.FormatString = value
[LocalizableAttribute(true)] public: virtual property String^ FormatString { String^ get (); void set (String^ value); }
/** @property */ public String get_FormatString () /** @property */ public void set_FormatString (String value)
ユーザー名表示用の書式項目を格納している文字列。既定値は "{0}" です。
解説
FormatString プロパティは、Web ページにユーザー名を表示する標準テキストの書式指定文字列を格納します。文字列 "{0}" は、ユーザー名を文字列のどこに挿入するかを示します。使用可能なプロパティ設定を次の表に示します。
既定値 ("{0}") | |
"Welcome to my site, {0}." | ユーザーのログイン時に "Welcome to my site, username." という文字列を表示します。ユーザーがログインしていない場合は、何も表示されません。 |
"Welcome to my site." | FormatString プロパティを文字列に設定している場合、ユーザーのログイン時にその文字列が表示されます。文字列に "{0}" が含まれていないため、ユーザー名は表示されません。ユーザーがログインしていない場合は、何も表示されません。 |
このプロパティを設定している場合、デザイナ ツールを使用して、その値を自動的にリソース ファイルに保存できます。詳細については、LocalizableAttribute、ASP.NET のグローバリゼーションおよびローカリゼーション の各トピックを参照してください。
ページ上で FormatString プロパティを使用する方法を次のコード例に示します。ボタンをクリックすると、表示形式が変更されます。
<%@ Page Language="VB" autoeventwireup="False" %> <script runat="server"> Sub Button1_Click(sender As Object, e As EventArgs) LoginName1.FormatString = "Welcome to our Web site, {0}" Button1.Visible = false End Sub </script> <html> <head> </head> <body> <form runat="server"> <p> <asp:LoginName id="LoginName1" runat="server" FormatString="Welcome, {0}" /> </p> <p> <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Change Format" /> </p> </form> </body> </html>
<%@ Page Language="C#" autoeventwireup="False" %> <script runat="server"> void Button1_Click(Object sender, EventArgs e) { LoginName1.FormatString = "Welcome to our Web site, {0}"; Button1.Visible = false; } </script> <html> <head> </head> <body> <form runat="server"> <p> <asp:LoginName id="LoginName1" runat="server" FormatString ="Welcome, {0}" /> </p> <p> <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Change Format" /> </p> </form> </body> </html>
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
Weblioに収録されているすべての辞書からLoginName.FormatString プロパティを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からLoginName.FormatString プロパティ を検索
- LoginName.FormatString プロパティのページへのリンク