hi in this post i will show how to call a javascript function from codebehind in asp.net :
Example:
aspx.cs page(codebehind):
protected void testMethod()
{
ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage1", "ShowalertMessage();", true);
}
aspx page:
<script type="text/javascript" language="javascript">
function ShowalertMessage() {
alert('hello world!');
}
</script>
Example:
aspx.cs page(codebehind):
protected void testMethod()
{
ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage1", "ShowalertMessage();", true);
}
aspx page:
<script type="text/javascript" language="javascript">
function ShowalertMessage() {
alert('hello world!');
}
</script>
No comments:
Post a Comment