Click here to Skip to main content
11,645,349 members (79,239 online)
Click here to Skip to main content
Add your own
alternative version

Events Between Web Forms

, 6 Jul 2007 CPOL 29.6K 873 49
Raise Events Between Web Forms Using CallBacks or Ajax
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ClientCallBack.aspx.cs" Inherits="ClientCallBack" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head id="Head1" runat="server">
  <title>Add a user using CallBacks</title>
  <script type="text/javascript">
    //Makes a Callback to the server
    function AddUser()
        //Construct the argument
        //The argument MUST be a string so if you need
        //to send more than one value use custom separators
        var argument = document.getElementById("txtName").value + "|" + document.getElementById("txtAge").value 
        //Make the callback to the server
        CallServer(argument, "");
    //Receives the CallBack Result
    function ReceiveCallBackResult(result)
        //Inform the user
        document.getElementById("ResultsSpan").innerHTML = result;
  <form id="form1" runat="server">
        User Name
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox><br />
        Age &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <asp:TextBox ID="txtAge" runat="server"></asp:TextBox><br />
      <br />
      <button type="Button" onclick="AddUser()">
      <br />
      <br />
      <span id="ResultsSpan" runat="server"></span>
      <br />

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
Mexico Mexico
I am Pedro Ramirez from mexico, work for, the company is located in Mexico, we do outsourcing and nearshore development, we are focused on SaaS nearshore development, I started with VB.Net, but now I am ambidextrous using VB.Net or C#.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150731.1 | Last Updated 6 Jul 2007
Article Copyright 2007 by Pramirez
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid