Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Ajax Control Implementation Problem

Reply
Thread Tools

Ajax Control Implementation Problem

 
 
madani@gmail.com
Guest
Posts: n/a
 
      01-07-2006
Hi,

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
(http://www.zumipage.com/tutorial1.htm)

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";
ReturnControls.Add(TextBox1);
}

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

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
(http://www.magicajax.net/)

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

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"
runat="server"></asp:TextBox>
<asp:Button ID="cmdTest" Text="Test" runat="server"
OnClick="cmdTest_Click" />
</ajax:ajaxpanel>

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

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?

-madani

 
Reply With Quote
 
 
 
 
madani@gmail.com
Guest
Posts: n/a
 
      01-12-2006
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
individually.

Regards
-madani

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ajax accordion control broken in ajax 1.0 Andy B ASP .Net 0 11-28-2007 06:49 PM
ASP.NET AJAX samples... I am looking for help with HoverMenu AJAX Toolbox control. JDeats ASP .Net 1 10-05-2007 07:50 PM
"ASP.NET AJAX-Enabled Web Site" or "AJAX Control Toolkit Web Site"? mark4asp ASP .Net 1 03-24-2007 06:06 AM
AJAX IDE and AJAX TOOL--The Release of JoyiStar AJAX WebShop 3 Beta minnie Java 1 12-13-2006 06:29 AM
New Question on Simple XML DOM Problem in AJAX Implementation dondraper XML 2 01-27-2006 08:47 PM



Advertisments