Heybo Blog

If you look at me when I'm talking, you'll see what I'm saying ... about Tech and .NET discoveries!

My Links

News

Story Categories

Archives

Post Categories

Image Galleries

Login

Blog Stats

Links

Personal Websites

Script alert with C# on WebForms

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>

posted on Wednesday, January 28, 2004 9:16 AM

Feedback

# re: Script alert with C# on WebForms 7/20/2005 6:51 AM dffg

sfdgdf

Title  
Name  
Url
Comments   
Protected by Clearscreen.SharpHIPEnter the code you see: