Ajax Control Implementation Problem

Discussion in 'ASP .Net Building Controls' started by madani@gmail.com, Jan 7, 2006.

  1. Guest


    I'm trying to make some ajax controls, I checked different ajax
    controls to find out how they works.

    main problem in developing ajax controls is updating other controls in
    events that occur in ajax calls.

    my controls use .NET 2.0 ICallBackEventHandler Internally and present
    some Methods that occur in some Ajax Call.

    As a very simple example, I made Button control that have Ajax OnClick
    Method, I call this method in my RaiseCallbackEvent. Assume that user
    change text of one text box in this Ajax OnClick Method. What I need to
    do is find changes, and send them to client side, and then apply them
    by JavaScript routines of my ajax control.

    I checked different controls to check:

    (1) How they find changes in other controls in ajax methods
    (2) How they send changes to client.
    (3) How they apply changes in client

    First I checked zumiPage Controls

    What it does to find out which control is changed is simple, it force
    user to add changed controls to a collection.

    Here is Sample:

    protected void Button1_Click(object sender, EventArgs e)
    TextBox1.Text += "1";

    to send changes to client and applying them, the easiest way is to
    render changed control individually. then in most controls you can
    change the whole control by set its outerHtml property to returned
    rendered control. But the problem is

    (4) how to render controls individually.

    zumipage solved this problem this way:

    it force you to inherit your page from zumiControls.zumiPage, So it can
    handle render of controls and get rendered html of controls that it

    Here is sample:

    public partial class MyPage : zumiControls.zumiPage

    Adding controls to a collection is not a good idea; user should always
    remember to add changed controls to ReturnedControls Collection. it's
    much better that Ajax control find changes by itself.

    Other Ajax Control that I checked was MagicAjax

    It's idea is really nice.

    It use an http module, you should add it to you WebConfig, it will
    store an instance of controls on server and use hash to find out which
    control is changes(1). This control is free and open source, and using
    it is very easy, it can add Ajax Functionality to existing standard
    Asp.net controls. All you need to add ajax functionality is too add
    your controls to a MagixAjax AjaxPanel. it will handle the rest by

    this control also render changed controls individually. it not big
    problem, because changed controls must be inside it's AjaxPanel
    control(4), and send the html of rendered control to client and apply
    them by JavaScript (2 and 3).

    here is simple example of this control :

    <ajax:ajaxpanel ID="Ajaxpanel1" runat="server">
    <asp:TextBox ID="txtSampleText"
    <asp:Button ID="cmdTest" Text="Test" runat="server"
    OnClick="cmdTest_Click" />

    And we have this in code behind:

    protected void cmdTest_Click(object sender, EventArgs e)
    txtSampleText.Text = "Text is Changed";

    Now when you Click on cmdTest button, it use AjaxCall and text of
    txtSampleText will change.

    It's very nice idea, but it's not what I need. I want to add Ajax
    Callback to my own controls.

    So I checked the third Control, it's Telerik CallBack Control (
    http://www.telerik.com/Default.aspx?PageId=2527 )

    What these controls are doing it's exactly same as what I'm trying to

    They developed set of controls like button, and give most of client
    side events as a Server Side Ajax Method of their controls.

    Here is simple example:

    <asp:TextBox ID="txtSampleText" runat="server"></asp:TextBox>
    <cc1:callbackbutton id="cmdTest" Text="Test" OnClick="cmdTest_Click"
    runat="server" />

    What we have in code behind is:

    protected void cmdTest_Click(object sender, EventArgs e)
    txtSampleText.Text = "It's Changed";

    As you see there is no need to add changed controls to a collection or
    inherit page from customized page class.

    I could not find out how it can find out which control is changed. And
    how it get html of changed controls. it shows that it's possible, but
    what I need to know is how?

    , Jan 7, 2006
    1. Advertisements

  2. Guest

    Actually the problem is:

    1. How to find changes in other controls in an ajax method, without
    asking user to add changed controls into a collection.
    2. How to get HTML of changed controls, or how to render them

    , Jan 12, 2006
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dondraper
    Jan 27, 2006
  2. minnie
    Andrew Thompson
    Dec 13, 2006
  3. Michael Tsang
    Richard Bos
    Mar 1, 2010
  4. Michael Tsang
    Phil Carmody
    Mar 30, 2010
  5. sanket
    Nov 3, 2011

Share This Page