Call a javascript function from call behind


I have a form opened in a radWindow. The RadWindow has to be closed using a javascript function.
However I want to save the work done before closing the window, using the btnClose_Click event in code behind.
I am new to JavaScript and followed instruction/example on the web, and it does not work.
Thanks for helping me and letting me know what is not working.

This is my code:

aspx file:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QuestionBuilder.aspx.cs" Inherits="SAPPHIRE.Form.Group.QuestionBuilder" %>

<%@ Register Src="~/Control/Assessment/Builder/sks_QuestionUpd.ascx" TagName="Question" TagPrefix="sks" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<html xmlns="">

    <form id="form1" runat="server">

        <tlk:RadScriptManager ID="RadScriptManager1" runat="server">

        <sks:Question ID="ctlQuestion" runat="Server"  visible="False" OnClick="ctlMenu_Click"/>

        <tlk:RadButton ID="btnClose" runat="server" Text="Close"  OnCommand="btnClose_Click"/>
        <cc1:ConfirmButtonExtender ID="cnfmCloseBtnExt" runat="server" TargetControlID="btnClose"  
        ConfirmText="Do you want to save prior to close the form?"/>

	<script type="text/javascript">
		function Close() {

Open in new window

aspx.cs file (btnClose_Event):
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;

protected void btnClose_Click(object sender, CommandEventArgs e)

            ClientScript.RegisterStartupScript(this.GetType(), "", "close()", true);

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
use ScriptManager.RegisterStartupScript instead as you're using ajax.

Here's an example:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AnneSKSAuthor Commented:
Thanks a lot, it's working!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.