PasswordRecovery.QuestionTemplate Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur templat yang digunakan untuk menampilkan tampilan PasswordRecovery Pertanyaan kontrol.
public:
virtual property System::Web::UI::ITemplate ^ QuestionTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };
[System.ComponentModel.Browsable(false)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.PasswordRecovery))]
public virtual System.Web.UI.ITemplate QuestionTemplate { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.PasswordRecovery))>]
member this.QuestionTemplate : System.Web.UI.ITemplate with get, set
Public Overridable Property QuestionTemplate As ITemplate
Nilai Properti
Yang ITemplate berisi templat untuk menampilkan PasswordRecovery kontrol dalam tampilan Pertanyaan. Default adalah null
.
- Atribut
Contoh
Contoh kode berikut menunjukkan templat default untuk tampilan Pertanyaan.
Penting
Contoh ini berisi kotak teks yang menerima input pengguna, yang merupakan potensi ancaman keamanan. Secara default, ASP.NET halaman Web memvalidasi bahwa input pengguna tidak menyertakan elemen skrip atau HTML. Untuk informasi selengkapnya, lihat Gambaran Umum Eksploitasi Skrip.
<%@ 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">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:passwordrecovery id="PasswordRecovery1" runat="server">
<questiontemplate>
<table border="0">
<tr>
<td align="Center" colspan="2">Identity Confirmation</td>
</tr>
<tr>
<td align="Center" colspan="2">Answer the following question to receive your password.</td>
</tr>
<tr>
<td align="Right">User Name:</td>
<td>
<asp:literal runat="server" id="UserName"></asp:literal>
</td>
</tr>
<tr>
<td align="Right">Question:</td>
<td>
<asp:literal runat="server" id="Question"></asp:literal>
</td>
</tr>
<tr>
<td align="Right">Answer:</td>
<td>
<asp:textbox runat="server" id="Answer"></asp:textbox>
<asp:requiredfieldvalidator runat="server" controltovalidate="Answer" errormessage="Answer." id="AnswerRequired">*</asp:requiredfieldvalidator>
</td>
</tr>
<tr>
<td align="Right" colspan="2">
<asp:button runat="server" commandname="Submit" text="Submit" id="Button"></asp:button>
</td>
</tr>
<tr>
<td colspan="2" style="color:Red;">
<asp:literal runat="server" id="FailureText"></asp:literal>
</td>
</tr>
</table>
</questiontemplate>
</asp:passwordrecovery>
</form>
</body>
</html>
<%@ 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">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:passwordrecovery id="PasswordRecovery1" runat="server">
<questiontemplate>
<table border="0">
<tr>
<td align="Center" colspan="2">Identity Confirmation</td>
</tr>
<tr>
<td align="Center" colspan="2">Answer the following question to receive your password.</td>
</tr>
<tr>
<td align="Right">User Name:</td>
<td>
<asp:literal runat="server" id="UserName"></asp:literal>
</td>
</tr>
<tr>
<td align="Right">Question:</td>
<td>
<asp:literal runat="server" id="Question"></asp:literal>
</td>
</tr>
<tr>
<td align="Right">Answer:</td>
<td>
<asp:textbox runat="server" id="Answer"></asp:textbox>
<asp:requiredfieldvalidator runat="server" controltovalidate="Answer" errormessage="Answer." id="AnswerRequired">*</asp:requiredfieldvalidator>
</td>
</tr>
<tr>
<td align="Right" colspan="2">
<asp:button runat="server" commandname="Submit" text="Submit" id="Button"></asp:button>
</td>
</tr>
<tr>
<td colspan="2" style="color:Red;">
<asp:literal runat="server" id="FailureText"></asp:literal>
</td>
</tr>
</table>
</questiontemplate>
</asp:passwordrecovery>
</form>
</body>
</html>
Keterangan
Properti QuestionTemplate berisi templat yang menentukan tampilan PasswordRecovery kontrol dalam tampilan Pertanyaan.
Tabel berikut ini mencantumkan kontrol yang diperlukan dan opsional yang digunakan dalam templat tampilan Pertanyaan.
ID atau Nama perintah | Jenis kontrol | Diperlukan/opsional |
---|---|---|
Answer |
Kontrol apa pun yang mengimplementasikan IEditableTextControl. | Diperlukan |
Submit |
Kontrol apa pun yang menyebabkan peristiwa menggelembung. | Opsional |
Kontrol Kirim dapat berupa kontrol apa pun yang menyebabkan peristiwa menggelembung, seperti Button, , LinkButtonatau ImageButton. Properti nama perintah kontrol harus diatur ke "Kirim".
Kontrol PasswordRecovery melemparkan HttpException pengecualian jika tampilan Pertanyaan tidak berisi kontrol yang diperlukan. Tidak ada pengecualian yang dilemparkan jika Anda memberikan ID kontrol opsional ke kontrol jenis yang salah; namun, kontrol kemudian diabaikan oleh PasswordRecovery kontrol.
Saat Anda menggunakan templat untuk menentukan tampilan tampilan Pertanyaan, hanya properti berikut yang memengaruhi perilaku kontrol:
Semua properti yang diwarisi dari WebControl (untuk detailnya, lihat PasswordRecovery tabel anggota kontrol).
Semua properti lain tidak aktif saat Anda menggunakan templat untuk tampilan Pertanyaan.
Berlaku untuk
Lihat juga
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk