define a javascript function for validation as below:
function Validate()
{
var flag = true;
var msg = "Following validations failed:";
if(document.getElementByID("txtBox1").value = "")
{
flag = false;
msg += "<br>Enter value for text box 1";
}
if(document.getElementByID("txtBox2").value = "")
{
flag = false;
msg += "<br>Enter value for text box 2";
}
if (flag = false)
{
alert(msg);
return false;
}
else
{
return true;
}
}
set the OnClientClick property of button as this function:
<asp:Button ID="btnSubmit" runat="server" OnClientClick="return Validate();" />