This way
HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function showSession(session) {
alert(session);
}</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtName" runat="server" />
<asp:Button ID="Button1" Text="Show Alert" OnClick="ShowAlert" runat="server" />
</div>
</form>
</body>
</html>
C#:
protected void ShowAlert(object sender, EventArgs e)
{
Session["Name"] = this.txtName.Text.Trim();
//here you are calling JavaScript functoin
ClientScript.RegisterStartupScript(this.GetType(), "alert", "showSession('" + Session["Name"] + "')", true);
}
Thank You.