Add your own alternative version
Stats
845K views 2.6K downloads 252 bookmarked
Posted
15 Sep 2005
|
Comments and Discussions
|
|
I see that you brought another cent to the AJAX madness I am into currently, I am trying to study it(broke completely my ASP2.0 n-tier datasource coding model).
What I understand is that there is MS ATLAS project, but it is FUTURE, so forget it. I did not plan to use such raw state, so there is ASP2.0 near completion with callbacks and we have old ASP 1.1 with various XHTMLhttp implementations.
What I didn't understand is - you brought NEW framework which look awesome with 1 month of work on it? Come-on, have you patented it ? And I see this new 'Iclientcallback' interface in article, does it mean you are using ASP.NET2.0 features? (which I would like you would use)
And why should I use the BIG PROJECTS like AJAX.NET when I can learn this simple elegant panel and I am O.K. in one day? AJAX.NET is developed for some quite time(years) and is BIG for me to study it(and works only with 1.1 I heard), your ellegant(I think) solution seems to be here few weeks and is functioning the best way I can imagine...simply I can code ASP.20 the way I used to.
Or should I use My.AJAX library which some are using or WHICH please...
PLEASE STOP IT!
I just want that the World stop now at least for a few days or so, and I can explore avaible solutions and choose one...I just need simple, which will work with my ASP20 project. OK? Then you can 'play' the World again so I get the recent version but at least stop for now and EXPLAIN me everything slowly and from begining heh.
If your panel would be completely ASP.20 I would be happy to stop here...and take it.
I need ajax for only simple things, I do not need mamoth projects like atlas.
Is there some homepage to this project?
Ah....
Which brougheers.
|
|
|
|
|
I understand how you feel.
Lots of means to implement AJAX, which to go with, some use hidden iframes, some HTTP modules, some XMLHTTP etc. Some package an infrastructure, some are just simple ways to connect a dropdown to a webservice.
Which 1.1 implemenation will be most easy to convert when you move your site to v2.0 ?
Thing to know is that all this is nothing new, read
http://www.eggheadcafe.com/articles/20050709.asp
Its just that we are now getting infrastructure which make developing these things a much easier.
I had a look at AJAX.NET and found it difficult to get started with and a bit limited in the controls you could return to, everything has to be in div. I also found there is now way for the clientcallbacks to change viewstate...for instance,if you change a dropdown it disables a validator.
This one looks good but I haven't investigated its potential for my needs.
I think ATLAS is something greater than AJAX....client callbacks are in ASP.NET but I think ATLAS is going to do more...there is a link to Scott Gutherie's blog on it in the eggheadcafe link.
Anyhow you are lucky to be able to focus on this, I am still caught up refactoring my website to CSLA.NET based business object and a complete set of nUnitAsp test.
|
|
|
|
|
Thank you for your response...
I have'nt sleep this night and everything is clearer much more .
After reading all the links(I already read link you provided(popular this days) but thank you anyway) I see that for me:
ATLAS will be cool, but is really not something to invest time if you are not mucho coder, and I am not. Because it is going to change and change and I have not time nor skill to send feedback, or play with something that big.
AJAX.NET seems a little strange...open source or not open source, people are still unsure and behaviour of author also with the PROFESSIONAL AJAX.NET is strange too. It is too big and simply not ellegant to me right now, after reviews I read i share same oppinion.
It seems the best way to do with ASP.20 callbacks feature(which I planned) is to FORGET ABOUT THEM! Sadly, but many reviews point that it will change my coding model in projects to some good extent(and also string is only avaiable parameter), and unless I built my own framework(I doubt i am so good there will be mess in my coding model. I saw some good api from BLeRoy to implement JavaScript types etc, but it seems certainly more complicated(and unsuported) than anything done around it, counting this panel projet in.
I read carefully My.AJAX.NET, link you provided mentioned it. It is ALMOST the best I found, very elegant with nice reflection solution.
http://jason.diamond.name/weblog/2005/07/06/my-ajax-dot-net-library
Simply I don't see a reason for me to use (sorry)bloated AJAX.NET when I can go with less than 1000 lines of code .dll with more elegant way, GREAT Jason. And I can compile with ASP.20 what I need.
What looks BEST is framework known as COMFORT ASP. I though It is another commercial control library using AJAX(DART etc), but found it is nice neat little poject with awesome results!
After big enthusiasm in it I found, it is on non-commercial use(unless you write author), autor did not even have his email, and ASP20 is still planned, not even alpha state. But the examples he provided are AWESOME, the best I seen.
No need to change my coding model of server postbacks, no need to change nothing. NICE and not so popular so I throw a link.
http://www.comfortasp.de/Default.htm
I go with My.AJAX.NET for now until I find or study that this panel project is better alternative.
It would be superb if some expert not I would study all the solutions, made some 3 scenarious easy projects, and use all avaiable AJAX tech to made them real and to compare frameworks. That would be cool and that would also help MS to drive ATLAS right way.
Again thanks for bringing old tech to new style for us, not so technicaly adapt.
|
|
|
|
|
Why does the world need a YAAI (Yet Another AJAX Implementation) ?
Well, when I started exploring the AJAX dimension I wasn't satisfied with the provided solutions; they required that I learn a new framework, a new way to program pages, and a rewrite of the existing pages (drop the asp.net controls to put the AJAX ones in). I wanted something that would require as few code changes as possible and no javascript at all (if possible). Thus, the AjaxPanel was introduced.
And (to get you more intimidated ) this is only the beginning. I have registered a project at sourceforge.net (open-source of course and LGPL) and i plan on adding many more features (validators working, synchronous callback, handling of onkeyup, onfocus etc. events to name a few). Of course, these "advanced" features will be for those that need them; you'll always be able to just drop an AjaxPanel on the page and be done with it. I'll post more details when i have a decent homepage.
asp20 coder wrote:
does it mean you are using ASP.NET2.0 features?
No, this is developed and tested only on 1.1. The only reason is that i'm not using 2.0 (yet). I believe that it can easily be ported to 2.0, and if someone wants to give me a hand while i complete the long-postponed transition to 2.0 he is more than welcomed.
|
|
|
|
|
Thank you for response, like I said(above comment)it is all a bit clearer to me now.
I choosed My.AJAX framework for me this day and my task now is to compare it to yours Panel one. Which looks better and which is more usable in ASP20, each minute I am considering yours to be a winner, now when it is sourceforge
It may not seem to but I am very happy I ended with only 2 AJAX implementation to explore.
I code in ASP.20 and C#2.0 but I can hardly give any help because I am not quality coder(obvious) as you are guys. Or not that confident to start changing someone libraries to generics or new asp20 callback models.
I know everyone is thinking there is ATLAS for us ASP20, but ATLAS is in my oppinion strange step. They should wait with it to ASP30, and now provide simpler solution for 2.0 relase with what they were showing us last 2 years. And not, they unveil it on PDC and now go and learn this - mamoth - api.
Question, did you see My.AJAX framework? If yes, what do you think about it, it seems nice to me, but has some problem with firefox rendering or smlt I heard last time.
|
|
|
|
|
asp20 coder wrote:
Question, did you see My.AJAX framework? If yes, what do you think about it
Well, if My.AJAX works with 2.0 i think you should go with it; my framework doesn't.
As far as 1.1 is concerned (or assuming that i port my framework to 2.0) then it's all about personal taste. If you like using javascript and want complete control of what's happening on your page, then My.AJAX is the appropriate choice. The AjaxPanel hides all the javascript complexities and allows you to focus on the server-side ASP.NET programming model.
Personally, i don't like using javascript; i think it makes code less readable and less maintainable. Whenever i need to
use it, and it's not something very simple, i always hide it behind a custom control.
Another aspect of this framework that is not so obvious but provides so much possibilities, is the idea of keeping the page and it's controls in memory so that you can manipulate them.
i.e. let's say that you want a button that every time you click on it, it adds a new checkbox (or a textbox whatever) inside a panel and assigns its changed event to the appropriate handler. You write something like this:
Button1_Click(object sender, System.EventArgs e)
{
CheckBox check = new CheckBox();
check.CheckedChanged += new EventHandler(PanelCheckBox_CheckedChanged);
AjaxPanel1.Controls.Add (check);
}
On the other hand, if you try to do the same using javascript and a callback to a server method it will more difficult and less elegant than this.
|
|
|
|
|
Is there a way to call a javascript function directly and dynamically from a code-behind page? I have called javascript functions by attaching a call to a button event and that works great but is there also a way to call a javascript function while executing some code on the server?
Thanks,
Harold
|
|
|
|
|
if (CallBackHelper.IsCallBack)
CalbackHelper.Write("myNiceJavaScriptFunction();");
|
|
|
|
|
Thank you. It worked perfectly.
|
|
|
|
|
I'm trying to handle more client side events, like for example onkeyup in a text box.
I added the following line in the Page_Load:
MyTextBox.Attributes.Add("onkeyup",
Ajax.CallBackHelper.GetCallbackEventReference(MyTextBox) +
" return false;");
The OnCallBack method is called when I press a key, but how can I associate the event with its own server side callback?
If I have many controls with many handled events, how to distinguish them?
|
|
|
|
|
Handling more client side events is on my TODO list for the next version. I'll try to make it easy to program (using server-side event-handling code and no javascript).
|
|
|
|
|
I found a way to handle those client side events with the current version.
In Page_Load :
MyTextBox.Attributes.Add("onkeyup",
Ajax.CallBackHelper.GetCallbackEventReference(MyTextBox, "MyTextBox_KeyUp") +
" return false;");
and in OnCallBack :
switch (Request.Form["__AJAX_EVENTARGUMENT"])
{
case "MyTextBox_KeyUp":
MyTextBox_KeyUp(MyTextBox, e);
break;
case ...
}
|
|
|
|
|
This will be useful for others too, thanks!
|
|
|
|
|
First of all I think this is an interesting approach and implementation of Ajax. I wanted to try this out on .net 2.0 but there is a problem with the rendering of the child controls in the Ajax.Panel.
Specifics, in class AjaxPanel,in the method ExtendedRenderControl, on the control.RenderContol(extwriter) when trying to render the clear button..the error message is "RegisterForEventValidation can only be called during Render();".
Any suggestions! I would like to see this working in 2.0.
You can email me directly if you need more info at tmiordan@hewitt.com.
Tibi Iordan
|
|
|
|
|
Hi there,
Great article! I am really keen to start using Ajax but have a problem...
I have a page which contains a radio button list, a datagrid and a graph control. Currently the autopostback of the radio button list is set to true, and on postback I populate the datagrid and graph, does this need to be changed? How do I get the callback to happen when I change selection of the radio button list so that only the datagrid and graph gets updated?
C
|
|
|
|
|
Only the controls that are inside an AjaxPanel will get updated without refreshing of the browser, so:
1. Put the radio button list inside an AjaxPanel so that its postback function is replaced by an ajax callback function.
2. Put the datagrid and graph either inside an AjaxPanel for each one, or in one AjaxPanel for both of them.
|
|
|
|
|
Thanks for quickly reply!
I have put the controls inside AjaxPanels as you suggested, and fixed the path to CallBackObject.js in web.config which was not correct, but I still can't get it to work. I get a windows message saying something like "cannot connect to server" and the browser throws me back to the default page of the web site, and in the event log I get the message "Event target AjaxPanel1.RBTimePeriod_1 wasn't found" (RBTimePeriod is my radio button list).
This is the HTML for the radio button list:
<asp:radiobuttonlist id="RBTimePeriod" runat="server" RepeatDirection="Horizontal" AutoPostBack="True" CssClass="radio">
<asp:ListItem Value="Daily" Selected="True">Daily <asp:ListItem Value="Weekly">Weekly
<asp:ListItem Value="Monthly">Monthly
I have a RBTimePeriod_SelectedIndexChanged event to run when seletion of radio button list changes (autopostback).
Any ideas?
Cheers,
C
|
|
|
|
|
Ooops, the code fragment didn't come out, hopefully it works now I have enclosed it in pre tags...
<asp:radiobuttonlist id="RBTimePeriod" runat="server" RepeatDirection="Horizontal" AutoPostBack="True" CssClass="radio">
<asp:ListItem Value="Daily" Selected="True">Daily</asp:ListItem>
<asp:ListItem Value="Weekly">Weekly</asp:ListItem>
<asp:ListItem Value="Monthly">Monthly</asp:ListItem>
</asp:radiobuttonlist>
C
|
|
|
|
|
There was a problem handling the RadioButtonList control. I fixed it, get the new source files and let me know if it works correctly.
|
|
|
|
|
It works ! Thank you ever so much Argiris, you have saved my day !
It didn't work at first, but I discovered that I had registered two controls with the same TagPrefix (cc1 'cos I just dropped them on page from design view without changing the TagPrefix name...), one in the page itself (Ajax) and one in a user control used in the page. This prevented the page from running properly. Anyway...
Thank you again ! I am very impressed with your speed of response.
Cheers,
Carin
|
|
|
|
|
I am using Ajax panel control for avoiding post back in my web form. I am creating some web controls during run time(Dynamic controls). Those controls i am assigning name in runtime. In such schenario i am using following type of statments for getting / setting control properties.
Ex : ((TextBox)this.FindControl("TextBox14")).Text = "My Text";
the above statement is not functioning if i use ajax panel control in my form.It is throwing object does not exists. Any one has any idea?
Thanks
D.Sathish
-- modified at 5:50 Wednesday 5th October, 2005
|
|
|
|
|
This happens because the AjaxPanel implements INamingContainer and thus appends its id before the id of its children.
There are 2 ways to solve this.
1. ((TextBox)ajaxPanel.FindControl("TextBox14")).Text = "My Text";
or
2. ((TextBox)this.FindControl( ajaxPanel.ID + ":TextBox14")).Text = "My Text";
assuming that ajaxPanel is where you are creating your web controls.
|
|
|
|
|
Thank you Argiris for your help on FindControl Issue. Now it is working fine.
Now, i am facing one more issue. This issue mentioned in limitations "http://www.codetools.com/useritems/MagicAJAX.asp"
I want to do some of my client side(javscript) validations in Button click event. But, after moving my button into Ajax panel control, my javascript functions are not firing. I found some notes in "http://www.codetools.com/useritems/MagicAJAX.asp" like 'You have to "manually" insert the appropriate javascript in the onclick event of the control.'. But i am not sure how to insert the javascript in the onclick event.
Currently i am included my javascript using Attribute functionality.
Button1.Attributes.add("onClick", "Javascript:Myjavascript();");
Any one can please help on this?
Thanks,
D.Sathish
|
|
|
|
|
I'm implementing a better way to replace normal postback for a callback (along with other features) but the next version will appear at the open-source project i'm preparing at sourceforge.net. With that version you will be able to add your "onclick" event without a problem.
In the meantime, here's a way to solve this:
Your javascriptMyjavascript function is not called because AjaxPanel puts AJAXCbo.DoPostCallBack('Button1',''); return false; on the onclick event of the button, thus replacing your function. You should:
1) Put the button inside its own AjaxPanel (ie. ajaxPanelBtn)
2) Set the SetCallBackForSubmitButtons property of ajaxPanelBtn to false. That way, the "onclick" event of the button will remain intact.
3) Use
Button1.Attributes.Add(String.Format("if (javascriptMyjavascript()) {0} return false;", CallBackHelper.GetCallbackEventReference(Button1)));
to set the "onclick" event of the button.
I know it looks messy but it's only temporary, next version is on its way 
|
|
|
|
|
Thanks for your reply. But, setting setcallBackForSubmitButtons property to false, is invoking post back. i really don't want to do that.
|
|
|
|
|
|
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
|