问题
Has anyone come across this issue? I have required field validation on a form that I have tested and know works in IE 7-9, Firefox and Chrome but in IE 10 it allows the form to submit without doing any validation. The site is in .Net 3.5. I have done some research online but I can't find anything about this.
回答1:
Most probably support.microsoft.com/kb/2608565.
Which means that your old browser capabilities settings incorrectly recognize ie10 as a browser which doesn't support javascript (which of course is not true). The updated browser capabilities file corrects this problem.
回答2:
So I figured out a way around it. I had tried the hotfix and that didn't fix it but I added in Page.IsValid to the submit and it works fine now. I didn't think this would matter since validation is normally client side only but it seemed to do the trick.
Edit: I originally used an incorrect hotfix as mentioned support.microsoft.com/kb/2608565 will fix this issue. Also as mentioned I should always have the Page.IsValid in my submits in case javascript is turned off.
回答3:
Hope this can help out.
protected void Page_Init(object sender, EventArgs e)
{
Page.ClientTarget = "uplevel";
}
来源:https://stackoverflow.com/questions/15745658/asp-net-validation-not-working-in-ie-10