The RegisterClientScriptBlock method allows you to run JavaScript function at the top of the browser page. It means Script run on Page_Load method. Lets take an simple example of that in ASP.NET.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string script = @" function Hello(){alert ('Welcome to dotprogramming.blogspot.com');}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MY Code", script, true);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body onload ="Hello()">
<form id="form1" runat="server">
</form>
</body>
</html>
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string script = @" function Hello(){alert ('Welcome to dotprogramming.blogspot.com');}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MY Code", script, true);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body onload ="Hello()">
<form id="form1" runat="server">
</form>
</body>
</html>