PasswordRecovery.QuestionTemplate Propriedade
Definição
Obtém ou define o modelo usado para mostrar a exibição Pergunta do controle PasswordRecovery.Gets or sets the template used to display the Question view of the PasswordRecovery control.
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
Valor da propriedade
Um ITemplate que contém o modelo para exibir o PasswordRecovery controle no modo de exibição de pergunta.An ITemplate that contains the template for displaying the PasswordRecovery control in Question view. O padrão é null.The default is null.
- Atributos
Exemplos
O exemplo de código a seguir mostra o modelo padrão para a exibição de pergunta.The following code example shows the default template for the Question view.
Importante
Este exemplo contém uma caixa de texto que aceita a entrada do usuário, que é uma possível ameaça à segurança.This example contains a text box that accepts user input, which is a potential security threat. Por padrão, as páginas da Web do ASP.NET validam que a entrada do usuário não inclui elementos de script ou HTML.By default, ASP.NET Web pages validate that user input does not include script or HTML elements. Para obter mais informações, consulte Visão geral de explorações de script.For more information, see Script Exploits Overview.
<%@ 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>
Comentários
A QuestionTemplate propriedade contém o modelo que define a aparência do PasswordRecovery controle no modo de exibição de pergunta.The QuestionTemplate property contains the template that defines the appearance of the PasswordRecovery control in Question view.
A tabela a seguir lista os controles obrigatórios e opcionais usados no modelo de exibição de perguntas.The following table lists the required and optional controls used in the Question view template.
| ID ou nome do comandoID or Command name | Tipo de controleControl type | Obrigatório/opcionalRequired/optional |
|---|---|---|
Answer |
Qualquer controle que implemente IEditableTextControl .Any control that implements IEditableTextControl. | ObrigatórioRequired |
Submit |
Qualquer controle que cause eventos de bolha.Any control that causes event bubbling. | OpcionalOptional |
O controle de envio pode ser qualquer controle que cause bolha de evento, como Button , LinkButton ou ImageButton .The Submit control can be any control that causes event bubbling, such as Button, LinkButton, or ImageButton. A propriedade de nome de comando do controle deve ser definida como "enviar".The control's command name property must be set to "Submit".
O PasswordRecovery controle lançará uma HttpException exceção se a exibição de pergunta não contiver os controles necessários.The PasswordRecovery control throws an HttpException exception if the Question view does not contain the required controls. Nenhuma exceção será gerada se você fornecer uma ID de controle opcional a um controle do tipo errado; no entanto, o controle é subsequentemente ignorado pelo PasswordRecovery controle.No exception is thrown if you give an optional control ID to a control of the wrong type; however, the control is subsequently ignored by the PasswordRecovery control.
Quando você usa um modelo para definir a aparência do modo de exibição de pergunta, somente as seguintes propriedades afetam o comportamento do controle:When you use a template to define the appearance of the Question view, only the following properties affect the behavior of the control:
Todas as propriedades herdadas de WebControl (para obter detalhes, consulte a PasswordRecovery tabela de membros de controle).All properties inherited from WebControl (for details, see the PasswordRecovery control members table).
Todas as outras propriedades ficam inativas quando você usa um modelo para a exibição de pergunta.All other properties are inactive when you use a template for the Question view.