---
title: "Using the Callback"  
description: "The Callback feature that enables you to retrieve page values and populates them to an already generated page without regenerating the page.  This cap"  
author: "Uttam Misra"  
published: 2010-10-09  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/152/using-the-callback  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Using the Callback

The [Callback](https://www.mindstick.com/forum/34086/jquery-callback-functions) [feature](https://www.mindstick.com/forum/541/what-is-new-feature-in-sql-server-2012) that enables you to [retrieve](https://www.mindstick.com/forum/34400/how-to-retrieve-form-values-in-controller-action) page [values](https://www.mindstick.com/forum/159360/how-to-write-sql-query-to-join-comma-separated-values) and populates them to an [already](https://yourviews.mindstick.com/view/88453/the-hidden-ways-ai-is-already-controlling-your-daily-life) generated page without regenerating the page. This capability makes it possible to change values on a page without going through the entire [postback](https://www.mindstick.com/blog/490/postback-in-asp-dot-net) cycle.\

##### It uses the following method:

- Page.ClientScript.GetCallbackEventReference()
- Page.ClientScript.RegisterClientScriptBlock()
- GetCallbackResult()
- RaiseCallbackEvent()

And it inherites class is **System.Web.UI.ICallbackEventHandler**

How we implement the Callback

##### Example:

**Step1:** we use the following code on [aspx page](https://www.mindstick.com/forum/218/how-do-i-create-an-aspx-page-that-periodically-refreshes-itself)

```
 <head runat="server">     <title>Callback</title>     <script type="text/javascript">        function ss()    {        var va=document.forms[0].Text1.value;    UseCallback(va,"");    }     function amit(Text1,context)    {    alert(Text1);    }     </script> </head> <body>     <form id="form1" runat="server">     <div>       <input id="Text1" type="text" runat="server" /><br />       <input id="Button1" type="button" value="button" onclick="ss()"/>     </div>     </form></body>
```

**Step2:** We write the following code on [aspx.cs](https://www.mindstick.com/forum/172/how-v-insert-data-into-table-and-display-into-gridview-in-aspx-cs-file-with-out-using-wizard) page.

```
 public partial class y : System.Web.UI.Page,System.Web.UI.ICallbackEventHandler {     private string aa = null;     protected void Page_Load(object sender, EventArgs e)    {         string cref = Page.ClientScript.GetCallbackEventReference(this, "arg", "amit", "context");         string cscript =  "function UseCallback(arg,context)" +            "{" + cref + ";" + "}";         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "UseCallback", cscript, true);      }     public string GetCallbackResult()    {         return aa;    }     public void RaiseCallbackEvent(string eventArgument)    {         aa = eventArgument;    }}
```

**Step3:** Run the [project](https://yourviews.mindstick.com/story/1788/things-to-ensure-your-construction-project-is-successful)

**[Output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular):**

![Using the Callback](https://www.mindstick.com/mindstickarticle/935d6d35-4391-49e4-86dc-e0f877419bec/images/c94c3903-4688-4eba-8cb2-f78f59ec0840.png)

---

Original Source: https://www.mindstick.com/articles/152/using-the-callback

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
