Sunday, December 30, 2012

Show Alert on a Button click without post back in ASP.NET


Add the JavaScrip function between page header tags.

<script type="text/javascript">
function ShowAlert() {
alert('Im a Alert');
}
</script>

Call the JavaScript function on the OnClientClick event of the button.

<asp:Button ID="Button1" runat="server" Text="Show Alert" OnClientClick="ShowAlert(); return false;" />

No comments:
Write comments
Recommended Posts × +