我的表格有一系列有效者:
<label class="required" for="price">price</label>
<input runat="server" id="price" name="price" type="text" required="required"/>
<asp:RangeValidator runat="server" ControlToValidate="price" ErrorMessage="Must be between 0 and 15,000" MinimumValue="0" MaximumValue="15000"></asp:RangeValidator>
但它拒绝接受22和5等价值观,但接受价值0和15 000。 首先,它使我的形式对所有投入都不敏感。 为什么限制有效者工作?
Edit: Here s the form button
在我拥有散射机时,似乎已经停电的提交功能。 如果我去除切割器,该法典将执行:
protected void btnSubmit_Click(object sender, EventArgs e)
{
formInputs.Visible = false;
emailNotification.Visible = true;
MailMessage mail = new MailMessage();
mail.To.Add(emailField.Value);
mail.From = new MailAddress("[email protected]");
mail.IsBodyHtml = true;
mail.Subject = "Your Form has been submitted";
mail.Body += "Location: ";
mail.Body += location.SelectedValue + "<br>";
mail.Body += " address: ";
mail.Body += address.Value + "<br>";
mail.Body += "price: " + price.Value + "<br>";
mail.Body += "Date submitted: " + todaysDate.Value + "<br>";
if (FileUploadControl.HasFile)
{
string filename = Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
mail.Attachments.Add(new Attachment(HttpContext.Current.Request.MapPath(filename)));
}
SmtpClient smtp = new SmtpClient(System.Configuration.ConfigurationManager.AppSettings["mailsetting"]);
smtp.Send(mail);
}