To alert programmaticaly for an event:
<for some event>
String sMyAlert= "<script> alert('Incomplete Data. Please Re-enter...'); </Script>";
Response.Write(sMyAlert);
To use alert for buttons try:
myButton.Attributes.Add("onclick","Javascript:return confirm('Are you sure?');");
You can have both the Server -Side as well as Client- Side validation control.:
<script language=javascript>
function fnValidate()
{
if(document.getElementByID("txtYourTextBox").value.length == 0)
{
alert(" poop ");
return false;
}
}
</script>
<form id="FORM1" onSubmit =" return fnValidate();">
</form>