You can do with Custom Validator and Client Side validation using JavaScript
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
body {
font-family: Arial;
font-size: 10pt;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:FileUpload ID="FileUpload1" runat="server" AllowMultiple="true" />
<asp:Button ID="btnUpload" Text="Upload" runat="server" />
<br />
<asp:CustomValidator ErrorMessage="Maximum 2 files allowed." runat="server" ForeColor="Red" ClientValidationFunction="ValidateFiles" />
<script type="text/javascript">
function ValidateFiles(sender, args) {
var maximum = 2;
var fileUpload = document.getElementById("<%=FileUpload1.ClientID%>");
args.IsValid = fileUpload.files.length <= maximum;
}
</script>
</form>
</body>
</html>
Screenshot