Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

Page: 1 2
# markfind 6/26/2007 10:44 AM
Anyone has successfully add support to Asp.net Ajax to the Cuyahoga framework?

I have tryed to add dynamically ScriptManager to PageEngine but custom modules (with a ScriptManagerProxy control) throw exceptions because doesn't find any ScriptManager on the page.

Marco
# markfind 6/27/2007 3:20 AM
Seems that Asp.net Ajax 1.0 and Cuyahoga 1.5 are incompatible.

The only way to add ScriptManager is throught template ascx: adding it dynamically in the handler doesn't works.

I have tested the tipical UpdatePanel and Timer combination: after 2 partial-postback, ajax emits an exception (404) because it doesn't find the page (it seems to use url instead of rawurl with shortdescription & c. parameters).

Hope next version of Cuyahoga address these incompatibilities..

Marco
# martijnb 6/27/2007 4:26 PM
Indeed, we should make things ready for ASP.NET AJAX, especially for module developers. I've been thinking about this myself too.

To be continued
# markfind 6/28/2007 4:09 AM (edited 6/28/2007 4:10 AM)
I found a solution.

Specifically the problem is occuring if you use a UpdatePanel with a AsyncPostBackTrigger trigger.

After 3-4 postback (with partial rendering), I don't know why, Asp.net Ajax check the existence of the page.

Cuyahoga's rewriting engine, in PageHandler class, method ProcessRequest calls UrlRewriter to normalize url with correct params (ShortDescription, etc.), but it leaves path.

So, if I have a home.aspx page as root page, my childs' urls have /home/default.aspx: a virtual path.

I have simply correct the path with a / because /default.aspx (an empty, dummy page inherited from Cuyahoga.Web.UI.PageEngine) exists..

Hope this helps to support Asp.net Ajax 1.0.

Martin, we need a rock solid Rewriting Engine and a framework more asp.net 2.0 way, without web application projects.. ;-)

Marco
# Muttok 6/29/2007 4:02 AM
Im really not a fan of Ajax .Net toolkit, its to heavy and adds a lot of client code. (And dont forget that they are splited into multiple files/resources, causing extra roundtrips)

I prefer prototype (lite) with JSON for easy and lightweight Ajax applications.

JSON.NET port:
http://www.newtonsoft.com/products/json/

Prototype:
http://www.prototypejs.org/

# martijnb 6/29/2007 5:32 AM
markfindAfter 3-4 postback (with partial rendering), I don't know why, Asp.net Ajax check the existence of the page.

Well, it shouldn't just do that :).
Kidding aside, we should find a way to make Cuyahoga compatible with ASP.NET AJAX. I created a Jira issue for Cuyahoga 1.5.1.
Martin, we need a rock solid Rewriting Engine and a framework more asp.net 2.0 way, without web application projects.. ;-)

About the rewriting engine: agreed, about ditching the ASP.NET 2.0 web application project model: no way!
# martijnb 6/29/2007 5:39 AM
MuttokIm really not a fan of Ajax .Net toolkit, its to heavy and adds a lot of client code. (And dont forget that they are splited into multiple files/resources, causing extra roundtrips)

Well, it has its pros and cons. It definitely lowers that barrier for AJAX functionality for module developers. And using other libs with the webforms model (that Cuyahoga uses) is a royal pain in the butt.

But indeed, one of the nasty things is that it adds so many extra requests. For example, browsing the codeplex site that uses ASP>NET AJAX isn't a nice experience because of all the script loading (and I even can't see why they need it anyway).
# markfind 6/29/2007 7:15 AM
Developer preferences apart, why not follow a standard way to do things, so we can have less problems in future?

Marco
# martijnb 6/29/2007 7:34 AM (edited 6/29/2007 7:35 AM)
markfindDeveloper preferences apart, why not follow a standard way to do things, so we can have less problems in future?

What do you consider a standard way to do things? The web application project model is part of VS 2005 and fully supported. Only problem is that you can't use it with VWD Express.
Or do you mean using ASP.NET AJAX? It's pretty obvious that this needs to be supported because it's more or less the only decent option when using WebForms (IMO).
# Efie 6/30/2007 7:54 PM
It seems like the problem is not caused by the url-rewriting class from Cuyahoga. The asp.net webform renders the action-attribute to the orignal location and that's the point where it seems to go wrong with asp.net Ajax (don't know why this is only happening whith the Ajax framework).

There are 2 possible solutions for this

1: Create a custom control
The solution is to write a custom-control class for the asp.net form-tag, which renders the action-attribute to the orignal (rawurl)
An example of this can be found here (didn't try this one out yet):
Post from vladimir vexler

2: Use a controladapter
ScottGu posted a solution for this issue by creating a control-adapter to render the action-attribute.
ScottGu's post

The second solution requires a App_Browsers directory in the web-project, what doesn't look really nice to me in a web application project.
The second solution does work. It rewrites the action-attribute with the rawurl from the browser. So the postback-action will be rewritten and Cuyahoga works just fine.

When you need the code, feel free to mail.

I will take a look at the dynamic loading of the script-manager.





# markfind 7/1/2007 7:53 PM
Great infos.

Next version (2.0?) of cuyahoga, to address ajax and other problems, could follow ScottGu and Vladimir suggestions:
1. Using Request.PathInfo Parameters Instead of QueryStrings
2. Using an HttpModule to Perform URL Rewriting
3. UrlRewriter.net - cool tool. can be downloaded from here: UrlRewritingNet.UrlRewrite
4. Using an HttpModule to Perform Extension-Less URL Rewriting with IIS7
5. ISAPIRewrite to enable Extension-less URL Rewriting for IIS5 and IIS6
6. And ofcourse Handling ASP.NET PostBacks with URL Rewriting - super important for anyone that is using Ajax.Net (ex-Atlas)

Here is his post: http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx

I don't know if we could use UrlRewritingNet.UrlRewrite, ie move rewiting from handler in an external HttpModule. We could check "subclassing" HtmlForm control, too.
# Efie 7/1/2007 10:23 PM
The first five suggestions do address url-rewriting issues, but I don't know whether they do solve the postback-issues or not , from what I've read none of these mentions the postback problems, only the form-control subclassing and creating a controladapter. I think for Cuyahoga 1.5.1 the control-adapter approach is nice (simple, easy and additional).

I've checked out the dynamic loading of the scriptmanager yesterday too, this is a bit more complex than I thought at first. The problem with the dynamic loading is the page-lifecycle, the script-manager should be loaded in pageengines preinit-event. But in this event a lot of the members are not initialized yet (they get initialized in the init-event), don't know whether is possible or not, but I'll try to initialize them in the pre-init event and after that dynamically initialize the scriptmanager. To be continued...



# Efie 7/3/2007 1:11 PM (edited 7/3/2007 1:22 PM)
I was wrong about the complexity of dynamically adding the scriptmanager to the page. You only have to add 2 lines of code to the page, they should be in the right spot (after the template is loaded and before the modules are loaded into the sections). This can be done in de LoadContent method (it hasn't a lot to do with loading content, maybe you should split up the method)
ScriptManager scriptmanager = new ScriptManager();
this.TemplateControl.Form.Controls.AddAt(0, scriptmanager);

It is important that the scriptmanager is at the first postition of the Form-control of the template, otherwise the updatepanels (in my test I used updatepanels with a button and a timer) won't load, because there is no scriptmanager available (or it doesn't appear for the controls that need it).

Maybe it's possible to have in the next version of Cuyahoga an option to load the scriptmanager per page, or even better, the pageengine has to detect whether the scriptmanager is needed.
# Efie 7/3/2007 1:55 PM (edited 7/3/2007 5:16 PM)
Just finished some other tests.

After looking in the System.Web.Extensions assembly, it seemed that all controls had a readonly ScriptManager property, so while loading the module for the section in the LoadModuleControl-method you could check all controls whether they have a ScriptManager-property.

For example after loading the control (this can use some optimization, in every request all controls will be checked):
foreach (Control c in ctrl.
{
    if (c.GetType().GetProperty("ScriptManager") == null)
    {
        if (this._sm == null)
        {
            this._sm = new ScriptManager();
            this._templateControl.Form.Controls.AddAt(0, this._sm);
        }
    }
}

This solution is not the most elegant one, I'm still searching for a nicer approach, so you won't have to reference the System.Web.Extensions assembly in the web-project (Mono doesn't have support for the Ajax-framework).
# Efie 7/5/2007 11:59 PM
I've made some progress in a somewhat more elegant solution, that doesn't require any modifications to the web-project.

I've created a new project Cuyahoga.Web.Extensions

In this project there are 2 baseclasses, one for the template, AjaxBaseTemplate (when you want to make a complete template Ajax-enabled) and one for the module, AjaxBaseModuleControl.

These baseclasses check whether the scriptmanager is already added, when it isn't added, a ScriptManager will be added to the page.

For the issues with the postback-action attribute, in this project there are also the FormRewriterControlAdapter and the RewriteFormHtmlWriter as ScottGu mentioned in his blogpost. The App_Browsers directory will be copied to the Web-project folder in the post-build event, because this folder is only required at runtime.

To create an Ajax-enabled website with Cuyahoga you only have to inherit from one of the two above mentioned baseclasses and create a reference to the Cuyahoga.Web.Extensions project. This way, adding Ajax support is optional and everything still works with Mono.

I'm testing this stuff at the moment and will ask Martijn to how we can make this available for everyone. When you are interested in the code or want to test it, feel free to mail me.


# greyd 9/13/2007 5:41 AM
EfieI've made some progress in a somewhat more elegant solution, that doesn't require any modifications to the web-project.

I've created a new project Cuyahoga.Web.Extensions

In this project there are 2 baseclasses, one for the template, AjaxBaseTemplate (when you want to make a complete template Ajax-enabled) and one for the module, AjaxBaseModuleControl.

These baseclasses check whether the scriptmanager is already added, when it isn't added, a ScriptManager will be added to the page.

For the issues with the postback-action attribute, in this project there are also the FormRewriterControlAdapter and the RewriteFormHtmlWriter as ScottGu mentioned in his blogpost. The App_Browsers directory will be copied to the Web-project folder in the post-build event, because this folder is only required at runtime.

To create an Ajax-enabled website with Cuyahoga you only have to inherit from one of the two above mentioned baseclasses and create a reference to the Cuyahoga.Web.Extensions project. This way, adding Ajax support is optional and everything still works with Mono.

I'm testing this stuff at the moment and will ask Martijn to how we can make this available for everyone. When you are interested in the code or want to test it, feel free to mail me.

This extension is available ?
Another question... Have you consider another framework instead ASP.NET AJAX ?
# greyd 9/24/2007 7:34 PM
Where i can get Cuyahoga.Web.Extensions ?
And... is MS Ajax.net based ?

Do You know the DOJO Toolkit ?
greyd
EfieI've made some progress in a somewhat more elegant solution, that doesn't require any modifications to the web-project.

I've created a new project Cuyahoga.Web.Extensions

In this project there are 2 baseclasses, one for the template, AjaxBaseTemplate (when you want to make a complete template Ajax-enabled) and one for the module, AjaxBaseModuleControl.

These baseclasses check whether the scriptmanager is already added, when it isn't added, a ScriptManager will be added to the page.

For the issues with the postback-action attribute, in this project there are also the FormRewriterControlAdapter and the RewriteFormHtmlWriter as ScottGu mentioned in his blogpost. The App_Browsers directory will be copied to the Web-project folder in the post-build event, because this folder is only required at runtime.

To create an Ajax-enabled website with Cuyahoga you only have to inherit from one of the two above mentioned baseclasses and create a reference to the Cuyahoga.Web.Extensions project. This way, adding Ajax support is optional and everything still works with Mono.

I'm testing this stuff at the moment and will ask Martijn to how we can make this available for everyone. When you are interested in the code or want to test it, feel free to mail me.

This extension is available ?
Another question... Have you consider another framework instead ASP.NET AJAX ?
# martijnb 9/25/2007 12:11 PM
greydWhere i can get Cuyahoga.Web.Extensions ?
And... is MS Ajax.net based ?

Erwin (efie) is still finishing the implementation but at this moment he is on a well deserved vacation so it can take a little while.
And yes, the first goal was to be able to support MS AJAX.NET but I believe there is also support for other libs (for effects etc.).
Do You know the DOJO Toolkit ?

Yes, one of the many client-side AJAX frameworks ;)
# greyd 9/28/2007 11:08 PM (edited 9/28/2007 11:10 PM)
It's possible analyze Erwin code ?

You said MS Ajax.net and AJAX.NET toolkit too ?

Ajax control toolkit it's a very desirable approach, but i've seen at this and another forums worrying questions... (amount of scripts, performance, load time, standardization, etc... )


Martin, have you some planning (or roadmap item) about a standard web control API (with menu, collection of input/output control, etc)?
Investigating mojo portal (www.mojoportal.com) i've been seen a little integration with OpenRico.


At my point, i've start a investigation with client side approach. Create and manipulate a large amount of user tasks with javascript and standard html.

My candidate strategy until this moment
use standard asp.net control and complement client side task with javascript features ( mainly dojo (0.9) OR yui 2.3.1 (yahoo user interface) )

Because some project questions, i'll try do some work in this way.

Another point:

How mature is Cuyahoga 2.0 at this moment ?


Thanks
martijnb
greydWhere i can get Cuyahoga.Web.Extensions ?
And... is MS Ajax.net based ?

Erwin (efie) is still finishing the implementation but at this moment he is on a well deserved vacation so it can take a little while.
And yes, the first goal was to be able to support MS AJAX.NET but I believe there is also support for other libs (for effects etc.).
Do You know the DOJO Toolkit ?

Yes, one of the many client-side AJAX frameworks ;)
# martijnb 10/1/2007 1:17 PM
greydIt's possible analyze Erwin code ?

Unfortunately, I don't have the code right here at the moment. Probably Erwin can post it when he returns.
You said MS Ajax.net and AJAX.NET toolkit too ?

Yes, it uses MS AJAX.NET and probably the AJAX.NET toolkit will work too.
Martin, have you some planning (or roadmap item) about a standard web control API (with menu, collection of input/output control, etc)?
Investigating mojo portal (www.mojoportal.com) i've been seen a little integration with OpenRico.

No plans about a standard web control API. I'd like to keep things as basic as possible without integrating 3rd part stuff.
How mature is Cuyahoga 2.0 at this moment ?

Not very mature. I strongly suggest you take the 1.5.0 version or use the 1.5.x branch from SVN.

Page: 1 2