The following is in Validation.js file:
function validateME(controlID, textMessage)
{
if(document.getElementById(controlID).value == "")
{
alert(textMessage);
document.getElementById.focus();
return false;
}
}
In header section of html include script tag:
<script language="text/javascript" src="./pathTo/Validation.js"><script>
In your ASP.NET page do this:
<asp:button id="btnsubmit" runat="server" text="Next" width="122px" onclick="btnsubmit_Click" onclientclick="return validate()"/>
Now in your code behind file in page load somewhere do this:
btnsubmit.OnClientClick = String.Format("return validateME('{0}','{1}');",btnsubmit.ClientID, "Field Xxx may not be emtpy");
By setting the OnClientClick from the behind code allows you to send all the nescessary parameters along that are needed.
If you have problems realizing this solution your welcome to ask me.
Cheers
Manfred