Sunday, March 11, 2012

How can Atlas help me here?

Hi,

use Page methods here. The ViewState is persisted and you have a chance to go through the Page lifecycle (but nothing will be rendered on the page).

Checkthis article on my blog and let me know if you need further help.


Hmm... I am still confused.

I know that page methods run through the complete page lifecycle. But I don't understand how thesynchronization of client and server would happen. In my application I have only 1 aspx page, with many different web parts placed on it. The user can add and remove webparts dynamically. If I define a page method in my aspx page, how is this going to reach my webpart server controls (and events, and properties)? And how my webpart is going to return information to update the element on the browser?

This is not clear to me.

In Anthem all this procedure is transparent. You just use Anthem controls on your webpart as you would use regular asp.net server controls.

I am trying to understand how I could achieve the same effect with Atlas, but I haven't found any example. Confused

Cheers,
Leo


Suppose you have a Button and a Label. This is a very simple example. When you click the Button you should get the date and time from the server and display it on the label.

In Atlas wemust work client side (of course, if not using the UpdatePanel).

Something like this:

<script type="text/javascript"> function btnClick() { // invoke web service to get date and time } function btnClick_Complete(result) { $('myLabel').innerHTML = result; } </script>

And in this case, if a postback happens, you lose your label information!

In Anthem you can do like this (server side):

private void button_Click(object sender, EventArgs e) { myLabel.Text = DateTime.Now.ToString(); myLabel.UpdateAfterCallBack =true; }
Then, if a postback happens the label still keeps the date and time information (because the Label existson the server and is totally synchronized with the span element on the client).
I still don't understand how we can work like this in Atlas... using a transparent"server side" approach, instead of programming javascript and handling state manually all the time.
I really need an advice on this issue. It's not clear wheter it's an Atlas limitation or something that I haven't learnt yet.

Why don't you want to use UpdatePanel?

I can't use UpdatePanel, because I am using webparts. Check this later:http://forums.asp.net/thread/1384660.aspx

The only supported configuration for the webparts is having one UpdatePanel wrapping the whole page. Well, not exactly the whole page, but the webpart manager and the webpart zones. In my case that means 90%.

So it's not possible to have any other inner UpdatePanel (to wrap my webparts). That means I have to manually code ajax (client side) functionality for my webparts, to have good performance. Code in javascript, handle state, etc. Otherwise each webpart postback would be handled big the UpdatePanel that is wrapping the whole page. And that means30 kbytes on the wire! That's not ajax, that's a full postback disguised as ajax (you just don't see the page flickering, but the contents being transfered are the same as a full postback).

So what do you think? In this case that we can't use UpdatePanel's... what's the alternative that Atlas can give me?

Cheers,

Leo


I don't understand why you couldn't use an UpdatePanel inside of a webpart. This is supposed to work if you're using the current CTP, AFAIK.

You can use an UpdatePanel insde a webpart.

What you can't have is an UpdatePanel for your page and zones (to handle the drag and drop of webparts)and an (inner) UpdatePanel inside your webpart. This is not supported.

In my scenario (where I want to have the drag and drop of webparts without a full postback), I have these choices:

a) continue coding the webparts ajax functionality in javascript, handling the state manually, etc. Which is a pain, but is doable.

or

b) mixing Atlas (for the UpdatePanel and the control toolkit) + Anthem (to use inside each webpart).

Is there any other alternative?

Cheers,
Leo


Hi,

in this case I'd go with the simpler solution, b, until the issue with UpdatePanel and WebParts is fixed.


I don't think nested updatepanels in webparts are an explicitly unsupported scenario. Looks more like a bug. Can you provide a simple repro and I'll file a bug?

Garbin... option b seem's the way to go...

Bertrand... I don't know if it's a bug or a not-supported scenario. But it just doesn't work.

The whole thing is described here (there is also code and steps to reproduce):

http://forums.asp.net/thread/1384660.aspx

Cheers,

Leo


Mike seems to be pretty positive that it's a bug that is going to be fixed.

Just an update:

If you want to use UpdatePanel to wrapan individual webpart, it doesn't work at all.Sad This is regardless of having an outer UpdatePanel or not. I just made a test rendering my webpart inside an UpdatePanel (without an outer UpdatePanel for the page). It still breaks the webpart drag and drop. You get multiple shadows and other weirdness.

The conclusion is: the only thing that works in the webparts scenario is having an UpdatePanel to wrap yourwhole page (WebPartManager, webpart zones and webparts). That means a lot of data travelling over the network for any kind of postback. That means again that I lose my "server side" ajax approach and need to go for a "manual" javascript solution (with all the inconvenience involved).

Atlas is not helping me much.


This is a screenshot of the problem:

http://www.spirited-kb.com/tmp/wp.JPG

You can see 2 shadows in this picture, but there are actually 3... and the drag and drop gets very slow!


As I told you, Mike seems to be pretty positive that this is going to be fixed. I'll be sure to forward him this thread so that he can tell you directly when he comes back from vacation.

No comments:

Post a Comment