473,396 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP.NET Ajax with GridView

balabaster
797 Expert 512MB
<Edit> This thread has been split off of this thread</edit>


@Frinavale
In theory, it should work relatively well... the downside is that if you've got a grid that you want to autopostback every single cell, then you've got unnecessary overhead of all the UpdatePanel instances... and if you use only a single UpdatePanel to wrap the whole grid, it doesn't fix the need to click twice on the cell you wish to select...

That won't work in the case of the OP who needs it to refresh data on the page - however, if it's just one textbox, then having the UpdatePanel around the list that needs updating and pointing the trigger to the textbox should work nicely.
Dec 4 '08 #1
7 3150
Frinavale
9,735 Expert Mod 8TB
@balabaster
I see your point...

In the GridView case I wouldn't consider using UpdatePanels for all of my cells...because, like you've said there would be a lot of overhead. I would look into writing my own Ajax to handle this. Even though UpdatePanels are convenient to quickly add Ajax capabilities to web apps., they are not always the best way to solve the problem.

Aside from that, you have to post back to the server regardless of whether it's to update a single element or the majority of the web page.

Even though asynchronous calls update a portion of the web page when the request returns, the ASP cycle remains the same... So the same amount of sever-side processing will need to be done regardless of whether you only want to update a single element or the whole web page.

Correct me if I'm wrong here, but I'm pretty sure it's the same overhead for full page updates as it is for partial page updates.
Dec 4 '08 #2
Frinavale
9,735 Expert Mod 8TB
For the GridView...have you considered creating a custom object that implements both the ITemplate Interface and IScriptControl Interface....where your scripts make Ajax calls to the server to update that row?
Dec 4 '08 #3
balabaster
797 Expert 512MB
@Frinavale
You're entirely correct. The UpdatePanel posts the whole page via an asynchronous javascript call, and the entire page life cycle is processed. The page is then rendered and sent back to the client where the javascript's callback pulls the html/script that is contained within the <ContentTemplate> tags of the received XML and replaces the data displayed on screen with it.

So as far as the server is concerned, if the postback occurs from an UpdatePanel or is an entire page postback, it's the same. It's just that the javascript handles it differently on the client side.

If you write your own javascript that contains an AJAX call however, you could have it call to a webmethod that just processes received data which could be as much or as little as needs to be posted to the server. It processes that data and passes back just the data that the AJAX call requests at which point, the javascript callback can do whatever you want. In this case, find the object in the document and replace its value, rather than replacing a whole block of html.

This way is much more efficient in terms of network and processing, but is a lot more intensive for the programmer...

Of course, wrapping every object with an UpdatePanel adds to the amount of processing the server needs to do in every case. It still needs to convert the XHTML to HTML and handle the viewstate etc etc etc...
Dec 4 '08 #4
balabaster
797 Expert 512MB
@Frinavale
We should move these posts to another thread instead of hijacking this one...
Dec 4 '08 #5
Frinavale
9,735 Expert Mod 8TB
I was thinking the exact same thing.
Do you have an existing thread on this topic?
Dec 4 '08 #6
balabaster
797 Expert 512MB
@Frinavale
Not yet, but I may do when I get as far as trying to fix this bug. I have more pressing issues to solve (and by pressing I mean interesting :))
Dec 4 '08 #7
Frinavale
9,735 Expert Mod 8TB
I've been trying a whole bunch of new (new for me at least) web technologies/techniques lately and this thread came to mind.

Apparently calling web services using JavaScript is a lot easier now :) You can create web methods that return JSON Objects and this simplifies things quite a bit in the JavaScript side of things. To get your web methods to return JSON Objects All you have to do is indicate that you want to use the Script.Services.ScriptService()

I've been starting to get away from the ASP.NET controls (like GridViews) lately and have found that it's making for a much lighter web application.

If you have time I'd recommend exploring this. Also, you should check out ASP.NET MVC (because it's absolutely awesome too!)
Jun 17 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: darrel | last post by:
I'm going to be diving into ASP.net 2.0 on a small project. I'd also like to use it as an excuse to start playing with some AJAX techniques. So, that leads to the obvious question: AJAX.net vs....
1
by: davidjgonzalez | last post by:
I have a GridView that has paging enabled. Each item (as defined in an ItemTemplate) includes several controls which have operations i would like to Atlas-enable. Everything is working well except...
4
by: CH. | last post by:
Hi, i read a lot of ajax stuff and i was asking myself this: when clicking on the fieldname in a gridview (sorting enabled), the whole database is sorted according to that field. Is the whole...
1
by: ashish ranjan | last post by:
Hi there, I m new in Ajax and right now i m trying to do small operation on gridview like add row in gridview, update and delete row from gridview with the help of Ajax. Please help me in...
0
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to...
0
by: jrnail23 | last post by:
I have a user control which contains an UpdatePanel, which contains a MultiView inside, with a GridView in one of the views. In my GridView, I have a ButtonField which is supposed to trigger a...
2
by: Raymond Du | last post by:
Hi, I am looking for a way to use Ajax inside gridview. I am not talking about putting a gridview inside an updatepanel and refresh the gridview, I want to use Ajax on per row basis, when user...
3
by: Jonathan Wood | last post by:
I am completely new to AJAX. I have a GridView control and my client is complaining that, whenever they select a row in the grid, the page resets to the top of the page. It seems like AJAX...
1
by: wagswvu | last post by:
I am trying to enclose SPGridView inside an UpdatePanel control in a user control page (.ascx), however whenever I click on the paging links for the grid, it still postbacks instead of partial page...
6
by: SAL | last post by:
hello, I'm using a radiobuttonlist in an updatepanel in an item template in a Gridview control. I'm populating the radiobuttonlist in the RowDataBound event. I have the control toolkit registered...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.