Click here to Skip to main content
15,920,102 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Could any one please help me that how can i call an alert message without any event in asp.net using C# please
Posted

Using Javascript
JavaScript
onclientclick="javascript:alert('Hello world');"
 
Share this answer
 
IN ONCLIENT CLICK OF BUTTON YOU CAN USE LIKE THIS
<script type="text/javascript">
function fnalert()
{
alert("Hi, this is alert...|");
}
</script>

<asp:Button  OnClientClick="javascript:return fnalert();" Text="Click Me"/>


YOU CAN USE THIS in CODEBEHIND LIKE THIS

Page.ClientScript.RegisterStartupScript(this.GetType(), "aa", "<script language='javascript'>alert('HI THIS IS ALERT');</script>");
 
Share this answer
 
v3
C#
Page.RegisterStartupScript(this.GetType(), "aa", "<script language="'javascript'">alert('ALERT');</script>");

Try this
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900