Click here to Skip to main content
13,089,690 members (52,081 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads


71 bookmarked
Posted 24 May 2006

Client Callbacks in ASP.NET 2.0

, 24 May 2006
Explains the concept of client callbacks in ASP.NET 2.0.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default2 : System.Web.UI.Page, ICallbackEventHandler
    string callbackResult = null;

    protected void Page_Load(object sender, EventArgs e)
        string cbref = Page.ClientScript.GetCallbackEventReference(this, "arg", "JSCallback", "context");
        string cbScr = string.Format("function UseCallBack(arg, context) {{ {0}; }} ", cbref);
        //  Response.Write("<BR>" + cbScr);

        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "UseCallBack", cbScr, true);
    public string GetCallbackResult()
        return callbackResult;

    public void RaiseCallbackEvent(string eventArgument)
        int n = int.Parse(eventArgument);
        callbackResult = (n * n).ToString();

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United Arab Emirates United Arab Emirates
Iam Nasir Ali Khan, working a software architect in Dubai, works primarily on Microsoft Platform, MCTS certified for windows/web/distributed/mobile/enterprise applications.
Also teaches CS courses in a university in dubai.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.170813.1 | Last Updated 25 May 2006
Article Copyright 2006 by NasirAliKhan
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid