473,842 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Atlas UpdatePanels with GridView sorting?

Hi all,

I'm a newbie to Atlas (and recently ASP.NET) after coming from a long
Java background, also have done quite a bit with an Ajax.NET/ASP.NET
1.1 project, but it was basically all javascript, nothing really having
to do with ASP.NET...

I'm attempting to put together an application that consists of several
GridView controls each bound to some xml data. Each table exists in
its own update panel. The two effects I'm going for are:

1. Sorts on the GridView should be handled through a PartialLoad, so
nothing else on the page changes (ideally that HTML wouldn't even be
created on the server side, especially if there is heavy processing
involved in recreating some of the tables).
2. I'd initially like the page to load blank (meaning no GridViews),
then have each GridView come down individually in its own partial load
call, thereby popping up on the screen as they arrive (this is because
the retrieval of data underlying some tables may be a very long
processing call, 1 minute in some cases. Other tables should be
available on the page even while that one is still loading server

So far I've been using UpdatePanels to implement this functionality and
have gotten some good results without truly understanding the lifecycle
of a PartialLoad request indepth (both client and server side).
However there are a few stumbling blocks that I've come across, as well
as questions about how Atlas partial loads are really performing their
job. Any advice that this group can provide would be greatly

I've created a small simulation to post here. We have one aspx page,
with two GridViews, each within it's own UpdatePanel:

<form id="form1" runat="server">
<atlas:ScriptMa nager ID="ScriptManag er1" runat="server" />
<atlas:UpdatePa nel ID="panel1" runat="server"
Mode="Condition al">
<ContentTemplat e>
<asp:GridView ID="table1" runat="server"
AllowSorting="t rue" OnSorting="Sort Table">
</ContentTemplate >
</atlas:UpdatePan el>
<atlas:UpdatePa nel ID="panel2" runat="server"
Mode="Condition al">
<ContentTemplat e>
<asp:GridView ID="table2" runat="server"
AllowSorting="t rue" OnSorting="Sort Table">
</ContentTemplate >
</atlas:UpdatePan el>
Obviously there is a ScriptManager on the page as well, with
EnablePartialRe ndering set to true. Next, in the code behind, I just
create a few lists of dummy objects to act as the model data for these
tables. I'm binding the GridView directly to these lists. I added an
event handler to handle the GridView sort calls when clicking on the
table headers, but haven't implemented the sorting yet (it's not
important for this example):

protected void Page_Load(objec t sender, EventArgs e)
// set up model for first two tables
Table1Model obj1 = new Table1Model("st ring", "another string");
Table1Model obj2 = new Table1Model("mo re strings", "and even

Table2Model obj3 = new Table2Model("A" , "B", "C");
Table2Model obj4 = new Table2Model("D" , "E", "F");

IList<Table1Mod eltable1Datasou rce = new List<Table1Mode l>();
table1Datasourc e.Add(obj1);
table1Datasourc e.Add(obj2);

IList<Table2Mod eltable2Datasou rce = new List<Table2Mode l>();
table2Datasourc e.Add(obj3);
table2Datasourc e.Add(obj4);

table1.DataSour ce = table1Datasourc e;
table2.DataSour ce = table2Datasourc e;

table1.DataBind ();
table2.DataBind ();


So the two things I'd like to accomplish go hand in hand here. One is
that I'd like to get the Page_Load to the point where only the GridView
that is being sorted needs to be rebuilt (ie. binding it to the model
again and then having ASP.NET render that HTML). Logically that should
be fine because the only HTML that should get swapped out on the
browser side is the HTML for that particular table. I can do that by
detecting which table fired the sort action using the parameter that
the Atlas PartialLoad seems to put in the Request, __EVENTTARGET. Thus
Page_Load becomes this:
if (!IsPostBack)
... create model like above for both tables on initial page

string eventTarget = Request.Params[__EVENTTARGET]; //
figure out which table asked for the sort.
if (eventTarget.Eq uals("table1"))
Table1Model obj1 = new Table1Model("st ring", "another
Table1Model obj2 = new Table1Model("mo re strings", "and
even more!");
IList<Table1Mod eltable1Datasou rce = new
List<Table1Mode l>();
table1Datasourc e.Add(obj1);
table1Datasourc e.Add(obj2);
table1.DataSour ce = table1Datasourc e;
table1.DataBind ();
else if (eventTarget.Eq uals("table2"))
Table2Model obj3 = new Table2Model("A" , "B", "C");
Table2Model obj4 = new Table2Model("D" , "E", "F");
IList<Table2Mod eltable2Datasou rce = new
List<Table2Mode l>();
table2Datasourc e.Add(obj3);
table2Datasourc e.Add(obj4);
table2.DataSour ce = table2Datasourc e;
table2.DataBind ();

This works very well actually (please forgive the code duplication
here, just a silly example).

Now I need to take this to the final step. On the initial page load, I
won't do any databinding at all. The HTML that is delivered to the
browser is just the empty <divtabs for each UpdatePanel. However,
how can I actually trigger the PartialLoad to happen from the browser,
one it has the initial blank page? It must be some custom javascript
that I'll execute in the page load which will essentially make
PartialLoad requests for each of the empty <divtags currently
existing in the page on the browser, and in those Page_Loads I'll
detect that it is a postback, figure out which table needs to load (it
won't be __EVENTARGET in this first case, it'll have to be a parameter
I provide, like the updatePanel name) and then databind just that one
to the model that gets computed (like above). How to execute those
though? Looking at the HTML rendered in the browser when I do render
all the tables at the start, I notice these important bits:

<script type="text/javascript">
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
function __doPostBack(ev entTarget, eventArgument) {
if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
theForm.__EVENT TARGET.value = eventTarget;
theForm.__EVENT ARGUMENT.value = eventArgument;
theForm.submit( );
// -->

and <a
href="javascrip t:__doPostBack( 'table2','Sort$ Field4')">Field 4</afor
the column headers of every table. When doing theForm.submit( ), why
does the browser know to execute this in the background as a partial
load, instead of doing a regular postback in which the user loses the
page and the entire page refreshes? I'm very unclear about that, if I
knew the answer, I could then write my own javascript to do the behind
the scenes postbacks for every table.

Or is there some way that Atlas provides to do this already by setting
up the appropriate properties on the ScriptManager or UpdatePanels?
Also, I do see a lot when researching update panels about providing
triggers, but I don't know how that factors in with triggering sort
events. Does Atlas recognize that the GridView is inside an
UpdatePanel, and create the necessary triggers? Or is this somehow
bypassing that functionality entirely?

Also, is there a way to debug through the client side javascript code
that makes up the Atlas client libraries? Where does one even find
this source, it is hidden within the Atlas.dll?
Thanks for any input!


Oct 11 '06 #1
1 3534
If you don't get an answer here you can try the Atlas (now renammed to
ASP.NET AJAX) forum at asp.net:


Oct 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update not the whole page, but a portion of the page. Strangely enough the URL below http://beta.asp.net/QUICKSTARTV20/aspnet/doc/ctrlref/data/gridview.aspx (VB GridView Paging and Sorting Callbacks example)
by: needin4mation | last post by:
Hi, I have a gridview and a detailsview. Is it possible to select a row in the gridview, not have a postback, and instead have a detailsview populate based upon the gridview - in Atlas, no postbacks? Thanks.
by: Chris | last post by:
Hi, I can't seem to find any info on calling a webservice with atlas and populating a gridview with the results. All the doc shows on the atlas website is alert. Who would want to alert? Please assist? Thanks
by: Piotrek | last post by:
Hi all. I am creating a web site, in which I would like to use Atlas. I created an user control (Test1), in which there is a DropDownList with some values. I set AutoPostbackProperty of this DropDownList to true. In addition I created new event (TestEvent), which is fired when selection is changed in DropDownList. Then I placed this user control on my another page, in which I have
by: majorone | last post by:
hello, i am new to atlas and trying to use it on my user control. but after i implemented the following code, i have got a error in yellow page: "MaintainScrollPostition is not supported on pages with partial rendering turned on" what's wrong? <asp:DropDownList ID="ddlLanguage" runat="server" AutoPostBack="True" DataSourceID="SqlLanguage" DataTextField="language_name"
by: Robert Scheer | last post by:
Hi. I think I have some conceptual questions here. I have an asp.net web application up and running and now I intend to use Atlas on some of my pages. I have read that after installing Atlas, I need to create a specific Atlas project. But what I need is to just adapt Atlas on existing pages, so my questions are: Can I simply add Atlas controls like UpdatePanel on an existing web application page? If so, do I need to adjust some kind of...
by: tcc.se7en | last post by:
Hi -- I have an ASP.NET web app that I just converted to use a Master Page for common content (banner and nav). I also just updated my version of the MS Ajax framework to the latest one (and had to rename my controls to <asp:...instead of <atlas:...etc..) I have a DetailsView on the page, with Edit and Insert capability. When I insert a record, I get an exception as follows, but it's after
by: Eduardo Klein | last post by:
Hi all I'm trying to convert an application that uses Atlas to use Ajax RC1. The ScriptManager is placed in the MasterPage and I have a Form with some UpdatePanels and a CollapsiblePanelExtender that uses this MasterPage. When I start the browser, the page comes empty. I turned Trace on and found out this:
by: Oriane | last post by:
Hi, I've written a Ajax enabled application with the Atlas .NET 1.0 extension and ASP.Net 2.0. I've put 2 UpdatePanels on a unique page with 1 timer on the second panel. This timer refresh a text label every 10 seconds. Meanwhile, when I click on the first panel to query and display some data from an Sql server 2005 database, the text label in the second panel disappear. In my understanding, the postback sent by the first panel...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.