Click here to Skip to main content
15,886,693 members
Articles / Web Development / ASP.NET

Client Callbacks in ASP.NET 2.0

Rate me:
Please Sign up or sign in to vote.
4.83/5 (20 votes)
24 May 2006CPOL5 min read 133.6K   573   72  
Explains the concept of client callbacks in ASP.NET 2.0.
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
<script type="text/javascript">
    function GetMessageFromServer() 
    {
        //alert('test');
        UseCallBack();
    }
    
    function JSCallback(TextBox1, context)
    {
        //alert(TextBox1);
        document.forms[0].TextBox1.value = TextBox1;
    }
    
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input type="button" id="Button1" runat="server" value="Get Message" onclick="GetMessageFromServer()"/></div>
    </form>
</body>
</html>
<%--function UseCallBack(arg, context)
{
    WebForm_DoCallback('__Page',arg,JSCallback,context,null,false);
}--%>

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.

License

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


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

Comments and Discussions