ASP.Net Tutorials
Validate a form with an image
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="utf-8" %>
<script runat="server">
sub submit(sender As Object, e As EventArgs)
myStatusLabel.Text="The form has been submitted!"
end sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Morina | ASP.Net Tutorials</title>
<style type="text/css">
<!--
.myTextFieldStyle {
border: 3px double #ccc;
}
.mySubmitButtonStyle {
margin-top: 4px;
border: 1px double #ccc;
}
.myStatusLabelContainer {
font: 14px Georgia, "Times New Roman", Times, serif;
color: #930;
margin-top: 20px;
}
-->
</style>
</head>
<body>
<form method="post" name="myForm" runat="server">
<asp:TextBox id="myTextField" width="380px" maxLength="90" CssClass="myTextFieldStyle" runat="server" />
<asp:RequiredFieldValidator ControlToValidate="myTextField" text="<img src='error.gif' alt='' />" runat="server" />
<br />
<asp:button onClick="submit" Text="Submit" runat="server" CssClass="mySubmitButtonStyle" />
<div class="myStatusLabelContainer"><asp:label id="myStatusLabel" runat="server" /></div>
</form>
</body>
</html>