PasswordRecovery.SubmitButtonType 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定當呈現 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 值。 預設為 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 屬性不會有任何作用。