Hola a todos...
tengo un formulario donde valido las entradas nulas, pero antes de validarlas le muestro un mensaje al usuario diciendo anticipadamente que toda
informacion marcada con ** es obligatoria, la cosa es que si dejo un campo obligatoria vacio le muestro q campo dejo vacio con el RequiredFieldValidator, la cosa es que tambien tengo que cambiar el mensaje y ahora no es de
informacion si no de
error pero no cambie he trado de capturar el evento q devuelve el RequiredFieldValidator pero no logro hacerlo.
espero q alguien me pueda orientar. saludos.
Código:
<form id="form1" runat="server">
<div id="Informacion" runat="server" class="notification information png_bg" visible="true">
<div> <strong>Informasjon!</strong> Felt markert med ** må fylles ut. </div>
</div>
<div id="Fail" runat="server" class="notification error png_bg" visible="false">
<div> <strong>Feil!</strong> Felt markert med ** må fylles ut. </div>
</div>
<asp:Label id="Message"
Text="Enter an even number:"
Font-Names="Verdana"
Font-Size="10pt"
runat="server"/>
<br />
<table>
<tr>
<td style="width:155px" class="font3 bold" valign="top">Meglernavn:</td>
<td><asp:TextBox ID="Meglernavn" runat="server" Width="180"></asp:TextBox></td>
<td><asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ControlToValidate="Meglernavn" Display="Dynamic">**</asp:RequiredFieldValidator></td>
</tr>
</table>
<br />
<asp:Button id="Button1" Text="Send" OnClick="ValidateBtn_OnClick" runat="server"/>
</form>
Code behind
Código:
protected void Page_Load(object sender, EventArgs e)
{
if (this.IsPostBack)
{
RequiredFieldValidator3.Validate();
if (RequiredFieldValidator3.IsValid)
{
Message.Text = "All entries are valid.";
Fail.Visible = false;
Informacion.Visible = true;
}
else
{
Message.Text = "There are one or more invalid entries.";
Fail.Visible = true;
Informacion.Visible = false;
}
}
}
protected void ValidateBtn_OnClick(object sender, EventArgs e)
{
}