PasswordRecovery.SubmitButtonStyle 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取对属性集合的引用,这些属性定义 PasswordRecovery 控件中“提交”按钮的外观。
public:
property System::Web::UI::WebControls::Style ^ SubmitButtonStyle { System::Web::UI::WebControls::Style ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.Style SubmitButtonStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.SubmitButtonStyle : System.Web.UI.WebControls.Style
Public ReadOnly Property SubmitButtonStyle As Style
属性值
对 Style 的引用,它包含定义“提交”按钮外观的属性。
- 属性
示例
下面的代码示例演示对控件中PasswordRecovery不同类型的“提交”按钮设置SubmitButtonStyle属性的效果。
<%@ 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>
注解
属性 SubmitButtonStyle 定义 控件中 PasswordRecovery “提交”按钮的外观。 此属性是只读的;但是,可以设置它返回的对象 Style 的属性。 可以在 窗体 Property-Subproperty
中以声明方式设置这些属性,其中 Subproperty
表示 Style 类 (例如 SubmitButtonStyle-ForeColor
) 的属性。 还可以以编程方式在窗体 Property.Subproperty
中 (设置属性, SubmitButtonStyle.ForeColor
例如,) 。
常见设置包括自定义背景色、文本颜色和字体属性。
属性的 SubmitButtonStyle 样式设置与控件的样式设置 PasswordRecovery 合并。 在 属性中 SubmitButtonStyle 所做的任何设置都覆盖控件属性 PasswordRecovery 中的相应设置。
设置将重写SubmitButtonStyle以下PasswordRecovery属性:
使用模板定义控件的初始视图或问题视图 PasswordRecovery 的外观时, SubmitButtonStyle 属性不起作用。