I have an aspx page where there is no code. Server code written inside a tag with a runat server attribute.
If i use
ClientScript.RegisterClientScriptBlock(this.GetType(), "Email", "GetEmail();");
in the event page_load(), it just prints GetEmail();when the page loads
My code looks like
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" language="javascript">
function GetEmail()
{
alert('hi');
}
</script>
</head>
<body>
<form id="form1" runat="server">
Some control here
</form>
</body>
</html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "Email", "GetEmail();");
}
</script>
Thanks in advance.
source
share