Click here to Skip to main content
11,926,933 members (53,311 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads


71 bookmarked

Client Callbacks in ASP.NET 2.0

, 24 May 2006 CPOL
Explains the concept of client callbacks in ASP.NET 2.0.
using System;
using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page, ICallbackEventHandler   
    string callbackResult;
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);

    #region ICallbackEventHandler Members

    public string GetCallbackResult()
        return callbackResult;

    public void RaiseCallbackEvent(string eventArgument)
        // perform some real operation
        callbackResult = "DotNET Rocks!";



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...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 25 May 2006
Article Copyright 2006 by NasirAliKhan
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid