Atlas M1 Refresh - Some More Goodies

Another quick tour of the enhancements to ScriptManager and the partial rendering/async post-back model added in the Atlas M1 (January) refresh build that further enable the server-control based AJAX model.

In December, we released the M1 build of Atlas featuring ScriptManager, UpdatePanel and extender controls, which has received pretty good feedback so far. You can read more about them in my quick tour and ScriptManager drilldown posts if you haven't had a chance to look at them yet. During the past month we've worked in parallel on creating an incremental refresh build (that went live today) that addresses key limitations, known issues, and user feedback alongside our next major release. With this M1 refresh build, you'll see a bunch of new goodies beyond key bug fixes around ScriptManager and the partial rendering/async post-back model to further enable the server-control based AJAX development model.

The improvements include support for redirects and error reporting, mechanisms to indicate progress, support for true post-backs when appropriate and more intuitive updating of UpdatePanels marked with Mode=Conditional.

Support for Redirects (302s) and Errors (500s)
We added support for redirects and errors during async post-back processing. Redirects now work as you'd expect when you call Response.Redirect back on the server. We've added some internal plumbing to have redirects prompt our client script update the browser location.

Errors are more interesting. Typically you want to inform the user of errors. We handle page errors, as well as HTTP pipeline errors inside ScriptManager. ScriptManager in turn allows you to transform errors into something that is end-user friendly (you almost never want to ship exception messages to the client, other than perhaps during development for debugging purposes). The default behavior is to send down exception text (as-is right now, but the plan is to honor custom error settings).

<atlas:ScriptManager runat="server" id="scriptManager" EnablePartialRendering="true"
  onPageError="OnScriptManagerPageError" />
<script runat="server">
private void OnScriptManagerPageError(object sender, PageErrorEventArgs e) {
  // Set e.ErrorMessage to something you want to send down to the client
}
</script>

On the client, the default implementation of the script is to show an alert messagebox. Its not the most friendly thing to do in the world, but it is orders of magnitude better than simply failing silently, and sending the page into a non-working state thereafter. You can customize the error display using the new ErrorTemplate property of the ScriptManager:

<atlas:ScriptManager runat="server" ...>
  <ErrorTemplate>
    There was an error processing your action.<br />
    <span id="errorMessageLabel"></span>
    <hr />
    <button type="button" id="okButton">OK</button>
  </ErrorTemplate>
</atlas:ScriptManager>

What we do out of the box is display this error in what looks like a modal dialog (we wash out the page with a partially opaque overlay and disable it). The only active UI are the elements inside your error template. The template mechanism allows you to design a rich error display. Something to keep in mind are the fixed "errorMessageLabel" and "okButton" ID values. ScriptManager generates XML-script that uses these special IDs to bind controls to the error message property and clear error methods of the PageRequestManager script object respectively. You could obviously write your own error handling logic and completely custom UI using script, or XML-script, but a key focus of the default functionality is to enable reasonably good behavior without requiring you to delve into client-side programming.

If you're curious on what is going on over the wire for these HTTP status codes, check out the network traffic via my Web Development Helper tool. You'll see what we do to propagate 302 codes using XMLHTTP, which otherwise attempts to internally handle it (not what you want in this case).

Support for Progress Indicators
Another very important aspect of creating a user interface is to indicate progress rather than leave the user guessing about what is happening. With the traditional post-back model, the browser's statusbar serves as a simple indicator of activity. With AJAX programming and with the partial rendering model, this default form of progress display is not applicable. In the spirit of making AJAX simple, we've added a new control, atlas:UpdateProgress, that works closely with the PageRequestManager class on the client to automatically enable progress display. Here's a basic sample:

<atlas:ScriptManager runat="server" id="scriptManager" EnablePartialRendering="true" />

<atlas:UpdatePanel runat="server" ...>
  ...
</atlas:UpdatePanel>

<atlas:UpdateProgress runat="server" id="updateProgress1">
  <ProgressTemplate>
    <img src="Progress.gif" /> Contacting Server...
  </ProgressTemplate>
</atlas:UpdateProgress>

Basically UpdateProgress is a templated control you can use to customize progress display, and place anywhere on the page. You could place an animated gif to indicate activity along with some text to indicate an async post-back is going on behind the scenes. Like everything else, the server control generates XML-script on your behalf to automatically have this piece of user interface show up when the PageRequestManager is in the middle of performing a post-back, and hide it when the response has returned.

PageRequestManager only supports a single out-going async post-back. This is because the server processing and resulting view state etc. must be updated before a second post-back can be issued. You may want to offer a mechanism to allow the end-user to cancel an operation (the browser's Stop button doesn't work for async post-backs). This is very simple. Just add a button with an ID set to "abortButton" (another special ID) inside your progress template. For example:

<atlas:UpdateProgress runat="server" id="updateProgress1">
  <ProgressTemplate>
    <img src="Progress.gif" /> Contacting Server... 
    <button id="abortButton">Stop</button>
  </ProgressTemplate>
</atlas:UpdateProgress>

Support for True Post-backs
Now that we've enabled post-back-less user interfaces, sometimes you do need to perform true post-backs. For example, if you have a Logout button, or if have a File Upload on your page. Another subtle case is when you have an existing user control or custom control that itself doesn't contain UpdatePanels, but does contain buttons. In the past, the default behavior of the buttons would be to cause a true post-back, resulting in updated rendering of the overall control. Now, with async post-backs, a post-back would happen, but any updates to the overall control rendering are lost.

With this refresh, we've made the model a bit more explicit. Essentially we have certain heuristics about which elements cause post-backs and which don't. The following cause async-post-backs:

  • Elements corresponding to controls that are inside an UpdatePanel
  • Elements corresponding to controls that are used as triggers for an UpdatePanel
  • Event targets (in the __doPostBack sense) that do not correspond to HTML elements (eg. the ID corresponding to <atlas:Timer> which does not render any UI)

So if you have a control, you could either set it up inside an UpdatePanel, or preferably add it as a trigger of the UpdatePanel that needs to be updated in response to its event. In the past, triggers were mainly an optimization technique to identify what needed to be updated. Now they go beyond that and also identify when async post-backs should take place. Incidently, this behavior goes well with the overall "Trigger" naming.

If you have a control that wants to induce async post-back, that doesn't fit one of the three built-in heuristics, you can call the new RegisterAsyncPostbackControl method on ScriptManager to register your control.

You'll find this is actually much more intuitive behavior. I too at first thought this was a step back, but upon examining some more complex pages (esp. those involving WebParts) this modified more selective behavior does make sense. You may need to look at pages you've created against the December CTP and see where you might need to explicitly specify some triggers.

Automatic and Conditionally Updating UpdatePanels
We've had the Mode property on UpdatePanel that can be set to Always (default) or Conditional. Setting mode to conditional allows you to control which UpdatePanel is updated during a request as an optimization technique. In the past, an UpdatePanel marked as Conditional would update if you either called its Update() method explicitly, or if an associated trigger was activated.

We've simplified this to some degree. If a control inside an UpdatePanel causes async-post-back, that UpdatePanel is automatically selected for an updated rendering. This simplifies the case where you might have otherwise needed a whole bunch of triggers on an UpdatePanel pointing at controls within its content template (somewhat redundantly).

As usual keep the feedback and comments coming! It is really exciting to see the enthusiasm and interest around this technology.


[ Tags: | | | | ]
Posted on Wednesday, 2/8/2006 @ 12:35 PM | #ASP.NET


Comments

94 comments have been posted.

Steve

Posted on 2/8/2006 @ 1:00 PM
Excellent news! Thanks for your hard work on all this

Rama Krishna Vavilala

Posted on 2/8/2006 @ 2:22 PM
I quickly tried out the error functionality. It worked great except for large pages, I had to scroll up.
Ability to selectively choose which controls cause async postbacks and which not is also great. I had to work hard to make my controls asyncpost back but in the end everything worked fine.

Dylan Hayes

Posted on 2/8/2006 @ 2:50 PM
Good to see more goodies coming through! I particularly like update panels are great as they are easy to add to existing code, so Atlas goodness can be retrofitted to existing code with minimal effort.
One thing I'd like to do (it may be that I'm doing the wrong thing - and clientside controls are the way ahead), is have clientside events fire after serverside stuff (like an update panel reloading) happen. My own requirement is to call a script which moves the scrolltop position to the end of a div with overflow, but I can see other times you might want to do this. Is this possible? I hooked an onload event to an element which was refreshed in an update panel, but it only fires on the page loading fully, not a partial postback. Keep up the great work, and more example please!

foobar

Posted on 2/8/2006 @ 3:01 PM
My goodness, an update already!

Nikhil, I want to thank you so much for all the hard work you and your team have done on this. You are making my life easier, and letting me develop more effective solutions for my clients.

foobar

Posted on 2/8/2006 @ 4:14 PM
I've been playing around with it now for a couple of hours. Works great for the most part. I do agree with Dylan that it would be great to have client side stuff happen after an async-postback. Also, the control.Focus() method (server-side) doesn't do anything when doing an async-postback.

Nikhil Kothari

Posted on 2/8/2006 @ 10:21 PM
Thanks guys...

Dylan and foobar: I agree with your scenario... and its something we should make super simple to program against. There is a fairly complex way to achieve this scenario right now using the propertyChanged event of PageRequestManager. It needs to be as simple as writing an OnLoad attribute on <atlas:UpdatePanel>. I can't promise just this moment which build it might show up in, but rest assured, its on the radar.

We have other ideas as well around further enhancing the capabilities of these UpdatePanel controls. Sometimes, even I am pleasantly surprised to the extent of scenarios you can target with this model - all without requiring app developers to muddle in script! I'd also love to see folks starting to build extender providers to enable other key scenarios outside of the core framework, and hear about those core set of scenarios that folks think we should enable very simply.

We'll look into focus as well for a future release. For now I think the assumption was around focus being preserved on the client across async postbacks, but I can see the scenario where you want to switch focus to something else.

Tarun

Posted on 2/9/2006 @ 12:17 AM
Great work... Nikhil, another release in just one month.
I must say ATLAS is rocking the web development.
Keep up the good work.

Sivy

Posted on 2/9/2006 @ 12:55 AM
Nice work, i like the process bar!!... to bad it doenst work with autocomplete

Nemesh

Posted on 2/9/2006 @ 2:31 AM
Hi Nikhil,

Thanks for such informative blog. I am new to Atlas and we tried to build an application by downloading the december release. We have a small problem in that I would appreciate your help in that.

We created 3 update panels and all update panels where having triggers associated with it.(All triggers were button clicks) Now we wanted to add controls at runtime upon clicking of a button in one updatepanel's panel control). We were successful in doing that. So now when we click a button, we have 10 textboxes in it.

Now when we tried to count the number of controls from another button but it does not ccount. Is there something which we are missing?

Also I was not able to find the february release but every person here who has posted seems that they have a copy of february release. Can you send me the link.

Thank you in advance.

Edgardo

Posted on 2/9/2006 @ 4:25 AM
Nice update, its very cool to have monthly CTPs :)

Tobi

Posted on 2/9/2006 @ 5:35 AM
Hi Nikhil,

Very very good stuff, but even though we have a few projects that are ported to ASP .NET 2.0 and we are using the Atlas builds we still have some ongoing in ASP.NET 1.1, are there any plans to provide a Atlas build for 1.1 or would we have to run 2.0 only? While we plan to migrate from ASP.NET 1.1 it is going to be around for a long while yet especially on the bigger solutions and we are handcrafting AJAX style solutions for it, it would be nice to do this in a standard way that would be compatible after migration.

Regards

Tobi

Steve

Posted on 2/9/2006 @ 5:42 AM
question on the progress indicator: is there a way to tell the progress indicator to not show up until maybe 2-3 seconds. The reason why is that it works great on longer running searches/actions, but on quick searches/actions it is borderline distraction.

I was thinking maybe a way to tie in the timer with the progress indicator?

Steve

Posted on 2/9/2006 @ 5:59 AM
Also, Nikhil - you ought to include your inplace edit control into the next release :)

I'd really like to see the community start to release different controls publically and let Atlas grow as a community project more and more.

One control type I thought would be great to see is a input mask control that works hand in hand with the regular expression validator control.

Michael

Posted on 2/9/2006 @ 6:06 AM
sounds good! one "nice to have" that occured to me as i was reading this is the ability to have multiple progress indicators each associate with an updatepanel or trigger. this way you could place indicators right beside the panel being updated and it would reflect what's going on with that area.

Nikhil Kothari

Posted on 2/9/2006 @ 7:29 AM
Sivy: You don't want to show progress for everything - it will end up being more of a distraction than something helpful. Autocomplete works in the background - the user doesn't have to wait for example. This is the sort of thing for which progress bars aren't appropriate.

Nemesh: You want to look for the January CTP (http://atlas.asp.net)

Tobi: Currently no plans to support ASP.NET 1.1.

Steve: Masked editing is something I've thought about. Good suggestion on the delayed progress indication.

Michael: We'll have more programmability around UpdatePanel in the future, which will probably enable you to address your progress scenario tied more closely to an UpdatePanel. The thing to keep in mind is that more than one update panel might be updated in any given request... and you probably don't want to distract your users with multiple progress bars. Today, users are used to one - in the statusbar.

Keep up the comments!

Matt Pantana

Posted on 2/9/2006 @ 8:11 AM
Hey Nikhil,

Atlas looks very cool thus far. I did have a couple of questions however. It might be possible, but I don't see an "elegant" way to deal with situations where someone might want to fire off an async method by simply "hovering" over something. Currently, I'm doing this by using the onmouseover javascript to change the text of a asp:textbox hidden by a div and then firing the __doPostback. While this method seems to work, it's a bit clunky. Did I miss anything that might have been a better way to do this?

Damir

Posted on 2/9/2006 @ 9:44 AM
Does M1 January refresh fix the Safari issue posted on http://forums.asp.net/1176091/ShowPost.aspx ?

foobar

Posted on 2/9/2006 @ 10:09 AM
Nikhil,

I should mention that Focus() sometimes works. It just doesn't seem to do anything within a Datagrid/Gridview.

foobar

Posted on 2/9/2006 @ 10:49 AM
Nikhil,

More on the focus front. What I am doing is setting the EditItemIndex for a Datagrid and then setting focus to a text field within that row. What seems to be happening is the form elements get created, but the focus command either never gets called or it gets called too early.

Matt Pantana

Posted on 2/9/2006 @ 12:27 PM
Is there any tentative dates for when ATLAS will be released (1.0)

Ayman Farouk

Posted on 2/9/2006 @ 12:53 PM
great bits.. but I have a small point. What if I wanna have different ProgressTemplate(s) for different UpdatePanel(s) ?
A.

Nikhil Kothari

Posted on 2/9/2006 @ 12:58 PM
Ayman: Interesting... I just replied on the different progress templates question on an internal discussion... basically this is a known limitation. We fully recognize you'll have different progress wording, possibly UI for different controls, and its something we intend to add support for over time.

Matt: This is the sort of scenario that you'd enable via an Extender control. Currently we don't have anything out-of-the-box that specifically enables your scenario. Its another thing I've actually discussed with couple of folks here on the whiteboard. On the radar, but again can't promise when exactly this might show up...

Travis James

Posted on 2/9/2006 @ 3:42 PM
This update of the UpdatePanel features along with the UpdateProgress control is really cool. However, is there a way (without writing extra Javascript) to make the previously visible content disappear automatically when the "trigger" button is pressed while waiting for new content to appear in the UpdatePanel?

Ramon Durães

Posted on 2/9/2006 @ 5:53 PM
This features of the ProgressTemplate use Image to "AbortButton"?

Ramon Durães

Posted on 2/9/2006 @ 6:06 PM
This ProgressTemplate using image fire postback?
input type="image" src="Images/fechar.gif" id="abortButton" /input

Tks

Ramon Durães

Posted on 2/10/2006 @ 6:55 AM
Nikhil,
This refresh support WebParts?
tks

Dariusz Tarczynski

Posted on 2/11/2006 @ 9:50 AM
Great job!

Marinus

Posted on 2/12/2006 @ 2:21 PM
I'm very pleased with Atlas and Nikhils's service around it.
I'm also using Infragistics, the webpanel and the SideBar.
Using this in combination with the UpdatePanel gives some problems:
The colors (and other style-properties) of the webpanel and sidebar are dissappearing.
Does annyone knows the problem and how to solve this?
From Infragistics I've got the tip to use <style type="text/css"></style> in the form-part , but this only helps in some cases.

Peter

Posted on 2/12/2006 @ 7:26 PM
I've had a go at implementing the newest UpdatePanel with a trigger tied to a TimerControl which then calls a server-side method to incrementally add more and more regular ASP.NET Controls to a regular ASP.NET Panel (in this example, called MyPanel) with each update.

I've managed to update the UpdatePanel contents, but I've found that with each update call it forgets(?)/overwrites(?)/resets(?) the previous iteration's updates to MyPanel even though I'm doing MyPanel.Controls.Add(MyNewControl) and I'm not clearing/deleting anything. It appears to lose MyPanel's incremental state/properties and revert back to the initial state (as it was when the page loaded the first time) at the beginning of each update. The only way around this I've found is to maintain a separate array of Controls on the server-side and write its contents to MyPanel's Controls at each update.

Furthermore, once I've finished adding controls to MyPanel and set the UpdateTimer to Enabled=false to stop the updates (is there a better way to disable/remove triggers?), the data from the last update is lost and wiped out completely, leaving my UpdatePanel completely blank as if I'd never added any controls. I've tried this both on Internet Explorer 6 and Firefox 1.5 to attempt to diagnose whether it's a browser rendering problem.

Have I misunderstood the UpdatePanel completely? Is it only possible to do complete refreshes and not incremental changes?

Nikhil Kothari

Posted on 2/12/2006 @ 9:35 PM
Peter, you'll need to track the controls you add (in view state/control state perhaps), and recreate controls on post-back (just like you would have to without UpdatePanel). I believe there is an MSDN article on dynamically created controls that should get you going in the right direction. You should be apply the same logic in this model as well.

Bardur

Posted on 2/13/2006 @ 5:00 AM
I was wondering if you have plans to support execution of scripts included in content that is updated.

We have some third-party controls that require some javascripts to initialize.

Matt Pantana

Posted on 2/13/2006 @ 6:44 AM
I have a gridview that is inside an UpdatePanel. Outside the UpdatePanel is a form with a button to add rows to the the gridview. Using triggers on the UP for the button works fine and the rows are added to the GridView. However, when I try to sort the gridview using the column headers I receive the following error:

An async postback was caused by a control within UpdatePanel 'ctl00$cph$Content$upRequests' but the panel could not be found in the page.

Any ideas on what I'm doing wrong?

Ty Barho

Posted on 2/14/2006 @ 12:38 AM
I am having a similar problem with getting that alert. All of my code seems well formed, appropriate triggers, conditional updatepanels, no "_"'d names. Doesnt make much sense.

Indo Gangsta

Posted on 2/14/2006 @ 8:24 PM
Where can I get some documentation/samples on RegisterAsyncPostbackControl ?

oaix

Posted on 2/15/2006 @ 4:26 PM
i have a webpart inside the update panel and it doesn't work with restore/minimize when EnablePartialRendering="true". anyone ever try that before? is it a bug or i missed something?

Craig

Posted on 2/15/2006 @ 6:30 PM
Hi Nikhil

What support is there for javascript to retrieve a .net class interact with it on the client (in javascript), then send it back to the server, without using web services? I thought there may be an attribute I would need to decorate a class with that would enable the Atlas framework to serialize and deserialize on transfer.

emma

Posted on 2/15/2006 @ 10:37 PM
Thank you so much you guys are really doing geat job. It is proving very beneficial for me as well as for my clients. Thanks fo your hard work.

Ivan

Posted on 2/17/2006 @ 1:26 AM
Thank you guys for this refresh. But I have an question:
I had an UpdatePanel placed inside a UserControl which was placed inside binded FormView, which all worked fine with the December release. When I tried the same configuration with January release it raised an exception "The UpdatePanel 'UpdatePanel1' was not present when the page's InitComplete event was raised. This is usually caused when an UpdatePanel is placed inside a template". Why this behavior is changed and how can I get it working with January release?

Carlos Loth

Posted on 2/17/2006 @ 12:09 PM
Hi,

I know it is little off-topic, however I think you like suggestions... ;-)

It is about a String.format method (which is an Atlas enhancement to default String class). This method replaces just the first occurence of markers (eg. "{0}", "{1}", etc) instead of replaces all occurrences. I changed this method as I show bellow to accomplish the behavior I want:

String.format = function(format) {
var placeholder;

for (var i = 1; i < arguments.length; i++) {
placeholder = "{" + (i - 1) + "}";

while (format.indexOf(placeholder) > -1) {
format = format.replace("{" + (i - 1) + "}", arguments[i]);
}
}
return format;
}

Thank's for all, you are doing a excellent work.

Nikhil Kothari

Posted on 2/17/2006 @ 4:20 PM
Bardur: There is some support for updating scripts in partial rendering, but generally it is preferred if the scripts are included as references.

Matt, Ty: Please use the forums to post appropriate snippets, and hopefully your problems can be resolved.

Indo: No docs just yet. General idea is you register your control. Then if an element whose ClientID == your control's ClientID or if there is a __doPostBack call with your control's UniqueID, we switch that postback into an async-postback.

Craig: Currently our serialization is tied to web services. With that you can create an instance of a .net class, get it on the client, modify it, and send it back to the server.

Ivan: Please place the UpdatePanel around the FormView, and not in the FormView.

Carlos: Thanks for the suggestion. We're actually significantly revamping String.format to support more .net-like functionality.

A humble JavaScript developer

Posted on 2/18/2006 @ 7:38 AM
C'mon man!

Why don't you just stop extending JavaScript DOM objects? First you define window.attachEvent on Firefox and now String.format?? One could have implemented a StringFormat function without prototyping the String. If extending standard objects was so freakin' cool why System.String is sealed?

You know, there are plethora of public domain JavaScript libraries that will just stop working when used along with Atlas. Do you really want to cause this to all developers that will use Atlas?

Steve

Posted on 2/19/2006 @ 8:51 PM
fyi, I was able to add this line: System.Threading.Thread.Sleep(2000); to my functions to give it a 2 second wait - this way my animated gif icon symbol I created will show long enough to not be 'irritating to the user'

Ivan

Posted on 2/20/2006 @ 1:16 AM
Well Nikhil that’s exactly what I did but it is not quite acceptable because i have two large selects in the form view which depend (when I change the value of the first the second must be reloaded and that’s what I used the UpdatePanel for - the second select was inside a UpdatePanel) Now entire FormView will be reloaded. The other problem is that the two selects are placed inside user control which is placed inside another user control which is placed inside the FormView so the web form which is using the outer user control should take care of the UpdatePanel which in my opinion is work of the user control. My request , guys, is if you could make UpdatePanel possible to be placed inside template :)

Magnus Mårtensson

Posted on 2/20/2006 @ 6:27 AM
"Special ID" you write. I personally like it since it's simple. How are you planning to document all these special features?

leandro koiti

Posted on 2/21/2006 @ 4:54 AM
Hi there!
first of all I'd like to congratulate you guys for such an amazing job!
well... I'm having a little bit of trouble trying to catch exceptions thrown by the application through the proxies generated by the scriptmanager from atlas.
I inserted the scriptmanager tag inside the head tag:
<atlas:ScriptManager ID="scriptManager" runat="server">
<Services>
<atlas:ServiceReference Path="WebService.asmx" />
</Services>
</atlas:ScriptManager>
I've already tried to put the GenerateProxy = "true" property and still doesn't work...
when I call a webmethod, I do something like:

WebService.WebMethod(attributes, onCallOk, onTimeout, onError);

the functions are inside a .js file.

The darkiest thing is that when the error occurs on my machine I can see the message from the exception, but, when someone from another machine (acessing my machine) receives the error, the message from the exception is sent empty, even when the same occurs...

is there something that I have to do to allow remote computers to receive the exception?

thanks a lot!!!
and keep the great work u guys are doing!!

TravisP

Posted on 2/21/2006 @ 9:36 AM
Nikhil,
I am loving the Atlas development, but my big question is if I have created a site using the December CTP, how do I then update that site to use the January CTP? I thought I could just create a new Atlas template and then transfer over the JS files from the ScriptManager dir and mod the web.config to match the new web.config, but I seem to be getting a Javascript Error when using the ScriptManager EnablePartialRendering='true' setting on my site.
Any suggestions? Anyone?
Regards
TravisP

Steve

Posted on 2/21/2006 @ 1:55 PM
The ObjectDataSource is effected by Atlas I noticed today.

When you select control fields, none show up that are within an UpdatePanel.

I had to comment out the updatepanel, select the controls, then uncomment out again

fyi

Steve

Posted on 2/21/2006 @ 1:58 PM
Correction: - it does show up if the ObjectDataSource is also within the UpdatePanel.

I mentioned an input mask textbox earlier, this would be a great sample to include - maybe as a tutorial on how to use Atlas to build controls?

Steve

Posted on 2/22/2006 @ 9:09 AM
I have my own input mask text box control that I wrote - it works well until I add a scriptmanager/update panel.

Could this be because I'm registering my scriptblock in my custom control ?

Is there a conflict there?

Steve

Posted on 2/22/2006 @ 9:21 AM
Fix: I was able to get my control to work. Thought I'd pass it on to others:

I had placed script tags around my string to register the script. I removed those start script and end script tags and instead used ClientScript.RegisterClientScriptBlock - set the last parameter to true (it was false prior).

After doing this the code ran fine.

Ivelina

Posted on 2/24/2006 @ 1:52 AM
Timer_tick event doesn't fire in FireFox? How to fix it?

Piyush Patel

Posted on 2/24/2006 @ 3:34 AM
Hi everyone

i got one error..in my page "An async postback was caused by a control within UpdatePanel 'ctl00$m$cphAcc$TestPanel' but the panel could not be found in the page." i m using master page and content page. i already set the web.config file properly. and i also try the "<atlas:ScriptManagerProxy>" too. but i m not able to solve this error.. and yes one more thing when i create new project and in this new project i have master page and content page too but here in this project the same code is working fine. just i have want know where i made a mistake in existing project.

thanx in advance

Ivelina

Posted on 2/24/2006 @ 5:05 AM
OK, I've posted earlier
"Timer_tick event doesn't fire in FireFox? How to fix it?"
I found that this not evrywhere, I moved my page to other folder, and there it works. Is this connected with some rights of the folders? I can get it.
And this happens only in FireFox.

Steve_UK

Posted on 2/25/2006 @ 5:44 AM
Hi
I really love the look of this Atlas, but dont really know how it can help me.
I have a current asp.net 2.0 project with four or five drop downs, each ones datasource dependant on the choice in the previous one. then finally populating a gridview, so my page is making a fair few postbacks so it seems like atlas would really improve this but i dont know how to really use it in my situation?
Should i be putting each combo in an updatepanel or all content so the header doesnt postback??
Also, i have installed the Atlas template....can i use Atlas in my existing projects? If so how?

Thanks
S

Steve

Posted on 2/25/2006 @ 7:30 AM
put all the dropdowns and the gridview in an update panel. Try it out

Steve

Posted on 2/25/2006 @ 7:32 AM
"Also, i have installed the Atlas template....can i use Atlas in my existing projects?"

copy the scriptlibrary folder (and contents) into your project & add a reference to the atlas .dll

add the controls to your toolbox by browsing to the .dll. Then drag the scriptmanager and updatepanel to the page - enable partial rendering via the scriptmanager properties

Steve_UK

Posted on 2/26/2006 @ 2:21 AM
Thanks Steve, that has worked a treat. I set to auto postback, added a trigger for my event on each drop down and like magic, no full postback and holds scroll postion!!!
Time to get playing with the drag and drop extender.....that looks cool!!

Fabrício Sperandio

Posted on 2/26/2006 @ 7:27 PM
Nikhil,

great job you guys are doing I am eager to use Atlas on real projects. I've tried to deploy a sample I did with the january release on an ISP provider under medium trust and it did not work. Could you tell me if the Atlas march's release will work under medium trust? Do you have some kind of workaround to tell me so I can use until there? I've talked with my ISP provider and them won't give full trust to my application.

Thank you,

Fabrício Sperandio

Steve_UK

Posted on 2/27/2006 @ 4:06 AM
Hi again....
I have tried to add Atlas into another.....but have come into a problem when trying to add the controls into my toolbox.

I have added the reference but when i pick the dll to get the controls from i get..
System.Web.AspHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKey=b77a5c561934e089 failed'

They only think different is that i save this project on a network drive rather than local.???
Any ideas??

Thanks
Steve

Inventisity

Posted on 3/1/2006 @ 7:09 PM
Hi Nikhil,

I was wondering if you can provide a short quick demo on:

Client side can call the code behind methods. Above you havev mentioned the use of the [webmethod] and other scripting objects, but a concrete example would be great!

Secondly, another demo showing the server side calling the client side would be helpful as well.

Thanks. :)

Runi Thomsen

Posted on 3/2/2006 @ 3:57 AM
Hi Hikhilk.

This release is simply fantastic. However, using the updatepanel set to conditional update I do not seem to be able to download files. In "normal" asp.net 2.0 I would write something like this:

DownloadLinkButton_Click(object sender, EventArgs e) {
string filename = _myFileName;
Response.ContentType="application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment; filename="+ _myFileName+".csv");
string val = GetFileDataString(myObject);
Response.Output.Write(val);
Response.End();
}

Do you have a workaround for this? (Of cource, I could redirect to an non ATLAS .aspx page, but I want to do it the right way)

Any pointer would be wellcome.

Regards

Runi Thomsen
M.Sc Software Development

Bobby

Posted on 3/4/2006 @ 4:36 PM
I hope the lack of responses lately mean the team is hard at work for the next release :)

I noticed Nikhilk nor ScottG have posted for awhile ..

Dave Sanders

Posted on 3/5/2006 @ 12:21 PM
The Usercontrol / UpdatePanel order issue isn't satisfying. Basically because it breaks the granularity it my mind. I should be able to have an atlas web user control and "package" it so that a calling page can just reference the control and be done. Having to put the updatepanel and script on the content page seems a little disjointed.

Is this the way it is forever, or is this going to change to allow the usercontrol to stand on its own?

Bobby

Posted on 3/5/2006 @ 7:56 PM
I personally love the update panel :)

Needs some tweaking.

But, I think the idea is that if you want, you can extend these to do what you need it to do as a control developer. As a page developer - I like the idea that I can just put these on the page and utilize my normal server side C# functions without rewiring the entire page.

Joel Rumerman

Posted on 3/7/2006 @ 1:06 PM
From above reading I gather that if I place a button inside an UpdatePanel the button acts a trigger (per se) of the UpdatePanel.

Is there a way to do this so that the button does not act like a trigger? I don't see why we can't just have explicit tirggers only.

Nikhil Kothari

Posted on 3/9/2006 @ 1:49 AM
Its great to see so many comments, and some comments from readers helping out other readers! :-)

Bobby, yes, things have been busy - upcoming release (stay tuned), and I've also been out of country on a user group tour.

Dave: UserControls and UpdatePanel - I think what you are asking for is the option to not have to wrap the user control into an update panel, but to have the functionality combined. We have some feature plans for a future release, that could enable your requirement (in an indirect way).

Joel, can you please explain your scenario - specifically, why is your button within an UpdatePanel? Could you restructure your page, so that the button in question is not in an UpdatePanel?

Ricardo Lacerda Castelo Branco

Posted on 3/13/2006 @ 10:48 AM
Nikhil,

I have a multiview control in a master page with one ContentPlaceHolder inside each view. Then I put the multiview control inside an updatepanel.

All works fine, changing views "without" postbacks.

The problem is: In a child page i have one fileupload control that doesn't work.

Is there any way to put the multiview and the fileupload working together with atlas?

thanks...

Josh Stitzel

Posted on 3/22/2006 @ 1:17 PM
Ahhh!! I am about to tear all my hair out over this...

Is there ANY sort of workaround that would enable a FileUpload control to work within an Update Panel. If so, please direct me to it. If not, why not? This seems like such a logical thing to include within Atlas.

jack33

Posted on 3/23/2006 @ 5:50 PM
Your blog is so hard to read with your color scheme.

Nikhil Kothari

Posted on 3/25/2006 @ 9:44 PM
Then change the color scheme to the light theme using the buttons on the top-right...

carlos

Posted on 4/2/2006 @ 5:37 PM
Is there ANY sort of workaround that would enable a User Control to work within an Update Panel. When I do a postback, everything seems to work ok (asp:TextBox for example), but my user control (An Input Textbox with a hooked method to the onKeyPress event to allow just numbers in it) returns an "object undefined" error. Any suggestion? Thx. in advance.

carlos

Posted on 4/2/2006 @ 5:43 PM
What can I do when, having my page with UpdatePanel, running perfectly, I find that the session has timed out, I use forms authentication, but it doesn't work in my "atlas enabled" pages, but yes in the others, redirecting me to the logging page, I would like to obtain de same result in my "atlas enabled" pages. Any suggestion? Thx. and congratulation for your job.

Vlado

Posted on 4/3/2006 @ 1:16 PM
Hi Nikhil,
I think that because UpdatePanel is not possible to use inside templates it negates all the work done by asp.net team on templated controls.

Chirag Pavecha

Posted on 4/6/2006 @ 2:55 AM
Hi Guys !!
i m using atlas in my project and facing a problem described as follows.
I have a dropdown inside a updatepanel, set autopostback to false; and i have one overlayextender div.
Now problem is when i overlay my div over the drop down it does'nt go back side of the grid, means dropdown is overlaying the div. and i can even make changes to the dropdown.
Pls suggest me any magical idea.
Thnks in advance.

Mia

Posted on 4/10/2006 @ 4:13 PM
I installed the March CTP. I am noticing a bug and I am not sure how to fix it. I have a wizard with 10 steps. This wizard is in a UpdatePanel. In one of the steps is a TreeView. If I make the TreeView Step the Active Step, then the TreeView is created and when I click on it, the tree collapses, but if I do not make it the active step, the Treeview gets created but user can't click the nodes. I get a javascript error.. Any ideas?

Vrushali Ghatpande

Posted on 4/16/2006 @ 11:58 PM
Hi All,

We are using Atlas April CTP. In our webpage, we are using DetailsView inside atlas UpdatePanel. DetailsView contains File Upload server control. At the time of uploading the file on server, cannot get the filename. If we try this without using atlas UpdatePanel, it works. But with Updatepanel it doesn't work. Please let us know the solution urgently..

Regards,
Vrushali

http://www.paketim.com

Posted on 4/20/2006 @ 1:16 AM
When will Atlas be available for production use? Thanks.

Rob

Posted on 4/24/2006 @ 11:28 AM
Hi Nikhil / everyone,

I'm just getting going with Atlas - looks great so far. I have a question that I hope someone may be able to help with:
I have a page with three UpdatePanels, let's call them A, B and C and I have a control in B (a webgrid from ComponentArt) which issues a postback when one of it's rows is selected. What I would like to happen is for that event to be processed on the server, however I only want C to update its display (because in B, that row in the grid automatically changes it's appearance, so there is no need for the grid to be redrawn). Do you know if this is possible, ie to switch off the normally-useful behaviour of Atlas always refreshing the UpdatePanel containing the control that triggered the postback.

Thanks for any help,
Rob.

ravi

Posted on 5/2/2006 @ 11:03 PM
I tried that Error Template which was given in atlas.asp.net. But iwas not able to get that . plz can anyone help me to overcome that.

www.paketim.com

Posted on 5/5/2006 @ 2:30 AM
Is it possible to inject javascript after panel update?

Francisco

Posted on 5/9/2006 @ 8:10 AM
Yes you can use file upload with atlas, following the next scenario:

Atlas update panel, containing the fileupload and the Upload button.

Add a html button (button1) outside the UpdatePanel

Disable the Onclick event for the Upload button and put something like __doPostBack('button1','') in the clientclick event for the upload button, and that’s it, the fileupload control is working.

Nyco

Posted on 5/14/2006 @ 5:38 PM
Francisco,

Can you please post some code to explain your method ? Does this mean that partial rendering can still be used ? How about the html button is it a hidden one ?

Coty

Posted on 5/18/2006 @ 10:52 AM
Hello,

I downloaded atlas today and i am trying to get it working correctly in an existing project that is well on its way. I read someone else asked the question earlier and was told to copy the scriptlibrary folder into the project. To do this I just dragged the folder into the solution explorer. i then added the reference "Microsoft.Web.Atlas.dll" that was placed in my bin directory.

the next step I am not sure what to do.

<<add the controls to your toolbox by browsing to the .dll. Then drag the scriptmanager and updatepanel to the page - enable partial rendering via the scriptmanager properties >>

How do I do this, and what .dll? I also don't see a scriptmanager and updatepanel to drag onto the page.

Thanks for any help,

Coty

Vijay Jain

Posted on 5/24/2006 @ 4:13 PM
I am using Atlas April CTP for building my web site. My page has a FormView surrounded with a UpdatePanel tag. The FormView in edit mode, contains a DropDownList, a button and a GridView.

The button click event handler reads the selected entry and updates the underlying object bound to the GridView and calls the GridView.DataBind().

The DataBind makes the CPU usage to reach 100% and the call does not end for atleast 30 seconds. Any clue? If I remove the Update Panel tag, the page refreshes in a split of a second.

Shankar

Posted on 6/6/2006 @ 5:39 AM
I have one user control with xml-script (for data binding). Eventhough i put it in update panel,the page is getting refreshed while loading data.May I know the reason?

Mohamad

Posted on 6/13/2006 @ 7:29 AM
Great work on the ATLAS project. ..
Is there a way to trigger an update panel by using a client side script? I have a grid that allows paging inside an update panel. Also I have a search feature that search for words inside the grid. What I'm trying to do is to change the grid page if a word match found on a grid page different than the current page. I have everything working so far except the page changing thing. I tried __do Post Back (GridID, 'Page$pagenumber') on a page that doesn't have an update panel and works fine. But when the grid is inside an update panel the __do Post Back () event doesn't fire. Is there any solution to this ???

Thanks.

Marco

Posted on 6/13/2006 @ 8:52 AM
The UpdateProgress is really nice. But it does not work in a MultiView control, if the view containing the UpdateProgress in not active.

Is there a workaround for this?

Thanks.

Francisco

Posted on 6/21/2006 @ 7:33 AM
Nyco sorry to respond until today, i was on vacation :P, here is the code server side:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
this.Label1.Text = FileUpload1.FileName;
}
protected void Page_Load(object sender, EventArgs e)
{
this.ButtonUpload.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(Button1, ""));
}
}


html side:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="Microsoft.Web.Atlas" Namespace="Microsoft.Web.UI" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<cc1:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True">
</cc1:ScriptManager>
<div>
<cc1:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="ButtonUpload" runat="server" Text="Upload" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</cc1:UpdatePanel>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="fullpostback" /></div>
</form>
</body>
</html>

Richard - ISC

Posted on 6/25/2006 @ 9:11 AM
I'm curious about the performance tradeoffs between housing UpdatePanels within template columns vs. wrapping the entire *View control in the UpdatePanel.

Do all of the form values post back regardless? (i.e. no savings in performace posting back to server since everything is sent back anyway.)
Does all of the form get sent back from the server to the UpdatePanel and then most of it is pared away? (i.e. no performance savings on the way back from the server, since the whole page is sent back anyway.)
If this kind of nesting is not permitted and/or the performance tradeoffs are minimal, should I just wrap my entire page content in a single UpdatePanel? Should I toss out UpdatePanels altogether and return to the nightmare known as SmartNavigation?

If there are performace savings related to wrapping the minimal amount of markup in an UpdatePanel, it makes good sense to go the extra mile and allow for UpdatePanels to be nested within Template definitions.

Ivan - I feel your pain.

Francisco

Posted on 6/26/2006 @ 9:06 AM
Richard I havent been working with Atlas to much but what I noticed is that it doesnt matter how many update panels you split your webpage, all of them will refresh automatically, to prevent this you can set the conditional mode and update them programatically.

Nitin Jain

Posted on 6/29/2006 @ 1:23 AM
Hi Nikhil.

I am new in the Atlas.

How can i call Page method (local page level method) from the atlas.

EShy

Posted on 6/29/2006 @ 6:32 AM
So with this upload file method there are two visible buttons?
also, it seems it just creates a full postback, is there any way to get the file sent with atlas? I used to do this with flash or xmlhttp manually

Francisco

Posted on 6/29/2006 @ 3:09 PM
I've updated the code, swap the button for a link button and set the forecolor the same has the background color :D

<%@ Page Language="C#" %>
<%@ Register Assembly="Microsoft.Web.Atlas" Namespace="Microsoft.Web.UI" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
this.ButtonUpload.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(this.LinkButton1, ""));
}

protected void LinkButton1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
this.Label1.Text = FileUpload1.FileName;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<cc1:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True">
</cc1:ScriptManager>
<div>
<cc1:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="ButtonUpload" runat="server" Text="Upload"/>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</cc1:UpdatePanel>
<asp:LinkButton ID="LinkButton1" runat="server" ForeColor="White" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton>
</div>
</form>
</body>
</html>

Joe McBride

Posted on 7/2/2006 @ 11:09 PM
Francisco,

Thank you for posting your work-around! My situation was a bit more complicated. My fileupload control was placed within a User Control, which was placed within an Update Panel, which is placed within a Master Page. Using your logic you don't even have to place the upload code into the click event of the control outside of the update panel ... just re-hook the click event of the control that is outside of the update panel back into the orignal click event of the fileupload control. =]

protected void Page_Load(object sender, EventArgs e)
{
// HACK: work around for AJAX upload
LinkButton ctrl = Page.Master.FindControl("UploadLinkButton") as LinkButton;
if (ctrl != null)
{
ctrl.Click += new EventHandler(UploadImageButton_Click);
UploadImageButton.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(ctrl, ""));
}
}

protected void UploadImageButton_Click(object sender, ImageClickEventArgs e)
{
Upload();
}
The discussion on this post has been closed. Please use my contact form to provide comments.