PasswordRecovery.SubmitButtonType プロパティ

定義

PasswordRecovery コントロールを表示するときに使用する [送信] ボタンの種類を取得または設定します。

public:
 virtual property System::Web::UI::WebControls::ButtonType SubmitButtonType { System::Web::UI::WebControls::ButtonType get(); void set(System::Web::UI::WebControls::ButtonType value); };
public virtual System.Web.UI.WebControls.ButtonType SubmitButtonType { get; set; }
member this.SubmitButtonType : System.Web.UI.WebControls.ButtonType with get, set
Public Overridable Property SubmitButtonType As ButtonType

プロパティ値

ButtonType 値のいずれか 1 つ。 既定値は、Button です。

例外

SubmitButtonType プロパティが有効な ButtonType 値に設定されていません。

次のコード例は、 プロパティのさまざまな設定のコントロールの PasswordRecovery [送信] ボタンの外観を SubmitButtonType 示しています。

<%@ page language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  void DropDownList1_SelectedIndexChanged(object Sender, EventArgs e)
  {
    if (DropDownList1.SelectedValue == "Button")
    {
      PasswordRecovery1.SubmitButtonType = ButtonType.Button;
      // <Snippet4>
      PasswordRecovery1.SubmitButtonText = "Enter User Name";
      // </Snippet4>
    }
  
    if (DropDownList1.SelectedValue == "Image")
    {
      PasswordRecovery1.SubmitButtonType = ButtonType.Image;
      // <Snippet3>
      PasswordRecovery1.SubmitButtonImageUrl = "userNameSubmit.png";
      // </Snippet3>
      PasswordRecovery1.SubmitButtonText = "Enter User Name Image";
    }
  
    if (DropDownList1.SelectedValue == "Link")
    {
      PasswordRecovery1.SubmitButtonType = ButtonType.Link;
      PasswordRecovery1.SubmitButtonText = "Enter User Name";
    }
  }
  
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ASP.NET Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
      <table border="1">
        <tbody>
          <tr>
            <td>
              <asp:passwordrecovery id="PasswordRecovery1" runat="server"
                submitbuttonimageurl="userNameSubmit.png"
                submitbuttontext="Enter User Name">
                <submitbuttonstyle font-names="Comic Sans MS" 
                  forecolor="White" 
                  backcolor="#00C000">
                </submitbuttonstyle>
              </asp:passwordrecovery>
            </td>
            <td align="center">
              Choose a button type:<br />
              <asp:dropdownlist id="DropDownList1" runat="server" 
                onselectedindexchanged="DropDownList1_SelectedIndexChanged"
                autopostback="true">
                <asp:listitem value="Button">Button</asp:listitem>
                <asp:listitem value="Image">Image</asp:listitem>
                <asp:listitem value="Link">Link</asp:listitem>
              </asp:dropdownlist>
            </td>
          </tr>
        </tbody>
      </table>
    </form>
  </body>
</html>
<%@ page language="VB"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
  Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    If DropDownList1.SelectedValue = "Button" Then
      PasswordRecovery1.SubmitButtonType = ButtonType.Button
      ' <Snippet4>
      PasswordRecovery1.SubmitButtonText = "Enter User Name"
      ' </Snippet4>
    End If
    If DropDownList1.SelectedValue = "Image" Then
      PasswordRecovery1.SubmitButtonType = ButtonType.Image
      ' <Snippet3> -->
      PasswordRecovery1.SubmitButtonImageUrl = "userNameSubmit.png"
      ' </Snippet3> -->
      PasswordRecovery1.SubmitButtonText = "Enter User Name Image"
    End If
    If DropDownList1.SelectedValue = "Link" Then
      PasswordRecovery1.SubmitButtonType = ButtonType.Link
      PasswordRecovery1.SubmitButtonText = "Enter User Name"
    End If
  End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>ASP.NET Example</title>
</head>
  <body>
    <form id="Form1" runat="server">
      <table border="1">
        <tbody>
          <tr>
            <td>
              <asp:passwordrecovery id="PasswordRecovery1" runat="server"
                submitbuttonimageurl="userNameSubmit.png"
                submitbuttontext="Enter User Name">
                <submitbuttonstyle font-names="Comic Sans MS" 
                  forecolor="White" 
                  backcolor="#00C000">
                </submitbuttonstyle>
              </asp:passwordrecovery>
            </td>
            <td align="center">
              Choose a button type:<br />
              <asp:dropdownlist id="DropDownList1" runat="server" 
                onselectedindexchanged="DropDownList1_SelectedIndexChanged"
                autopostback="true">
                <asp:listitem value="Button">Button</asp:listitem>
                <asp:listitem value="Image">Image</asp:listitem>
                <asp:listitem value="Link">Link</asp:listitem>
              </asp:dropdownlist>
            </td>
          </tr>
        </tbody>
      </table>
    </form>
  </body>
</html>

注釈

プロパティは SubmitButtonType 、コントロールにエントリを送信するために使用されるボタンの種類を PasswordRecovery 決定します。

次の表に、 プロパティの各値に使用されるボタンの種類を SubmitButtonType 示します。

SubmitButtonType 値 使用されるボタン
Button 標準の HTML ボタン。 プロパティは SubmitButtonText 、ボタンのテキストを提供します。
Image プロパティに格納されている場所にある SubmitButtonImageUrl イメージ。 プロパティは SubmitButtonText 、画像の代替テキストを提供します。
Link HTML リンク。 プロパティは SubmitButtonText 、リンク テキストを提供します。

テンプレートを使用してコントロールの PasswordRecovery 外観を定義する場合、 SubmitButtonType プロパティは無効です。

適用対象

こちらもご覧ください