473,675 Members | 3,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView and ObjectDataSourc e Sorting

Hi,

I have an ObjectDataSourc e bind to a GridView and Sorting is enabled.

I have no problem with sorting, I implemented IComparer but I don't want to
fetch my data each time from my database. I'm new with web development so I
don't know if I do it right.

What I do right now is putting my object in Cache, when the user sort the
data, I retrieve my object from the cache and do the sort on the object.

It working well right now but I'm the only one to test the site.

My question is, using the Cache is it the good thing to do. It is per user
request and I'm not sure that Cache is for only one user...

Help me please, I will send you a real tasty Canadian Beer :o)
Jul 12 '07 #1
2 3150
You should be able to specify Caching directly on the ObjectDataSourc e control.
Pete
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder( BETA): http://www.blogmetafinder.com

"Ghistos" wrote:
Hi,

I have an ObjectDataSourc e bind to a GridView and Sorting is enabled.

I have no problem with sorting, I implemented IComparer but I don't want to
fetch my data each time from my database. I'm new with web development so I
don't know if I do it right.

What I do right now is putting my object in Cache, when the user sort the
data, I retrieve my object from the cache and do the sort on the object.

It working well right now but I'm the only one to test the site.

My question is, using the Cache is it the good thing to do. It is per user
request and I'm not sure that Cache is for only one user...

Help me please, I will send you a real tasty Canadian Beer :o)

Jul 12 '07 #2
The data source 'ObjectDataSour ce2' does not support sorting with IEnumerable
data. Automatic sorting is only supported with DataView, DataTable, and
DataSet

This is what happen when I turn EnableCache when I work with custom object...
"Peter Bromberg [C# MVP]" wrote:
You should be able to specify Caching directly on the ObjectDataSourc e control.
Pete
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder( BETA): http://www.blogmetafinder.com

"Ghistos" wrote:
Hi,

I have an ObjectDataSourc e bind to a GridView and Sorting is enabled.

I have no problem with sorting, I implemented IComparer but I don't want to
fetch my data each time from my database. I'm new with web development so I
don't know if I do it right.

What I do right now is putting my object in Cache, when the user sort the
data, I retrieve my object from the cache and do the sort on the object.

It working well right now but I'm the only one to test the site.

My question is, using the Cache is it the good thing to do. It is per user
request and I'm not sure that Cache is for only one user...

Help me please, I will send you a real tasty Canadian Beer :o)
Jul 12 '07 #3

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

Similar topics

1
5292
by: Arjen | last post by:
Hi, I databind my gridview like this: GridView1.DataSource = Membership.GetAllUsers(); // asp.net 2.0 (MembershipUserCollection) GridView1.DataBind(); When I try to sort the gridview I get this error message: The GridView 'GridView1' fired event Sorting which wasn't handled.
1
1137
by: sloan | last post by:
Ok, I've gotten somewhat handy with the new GridView. And I have it bound to a business object datasource, via the ObjectDataSource. Lets say I have 3 databound columns EmpID, LastName,FirstName I have it working where.... If I click the Header, that it will sort based on the Header I click. I even have DESC working if they click the same column header twice.
0
2075
by: ferherra | last post by:
Hi, Hope someone can help... I databind my gridview (asp.net 2.0) like this: GridView1.DataSource = Membership.GetAllUsers(); (MembershipUserCollection) GridView1.DataBind(); In the GridView1_RowDataBound eventhandler I'm getting the user role for each user (each user will only have and
1
2171
by: syl | last post by:
Hello I am trying to create a "easy to use" gridview with filters (dropdownlist in headers), sorting...and much more.... In order to do that, i prefer to use a objectdatasource (ODS) beacause filters and sort are automaticly managed.... I would like that my own gridview (inherited from system.web.ui.webcontrols.gridview) includes a ODS which I expose by properties. In that way, I use this "advanced" grid view without adding on
4
5478
by: kurt sune | last post by:
I have a an aspx page with a gridview. The gridview is data bound to a generic list of custom classes. The gridview's DataSource is thus not set. Now I want to add sorting to it. So I create an eventhandler thus: Protected Sub grdResult_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles grdResult.Sorting
8
18081
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to display data in a "GridView" which is tied to an "ObjectDataSource". In turn, this ObjectDatasource gets it's data from a strongly-typed business object within my code.
3
2187
by: Marc Grutte | last post by:
Hi I am trying to bind a custom datasource to a gridview whilst paging is enabled. What is missing in this code to make the paging + binding work? thanks M <%@ Page Language="VB" %>
0
1405
by: pargat.singh | last post by:
Hi: I am using a grid and having a problem with sorting. Below are my code and change the header name at run time as below based on language.If i don't change the header name it work. Can someone please help me so that i can enable the sorting and change the header as well. Thanks, in advance. <asp:GridView ID="GridView1" CellPadding="5"
2
3340
by: Aamir Ghanchi | last post by:
hi, I have a gridview which is bound to ObjectDataSource which in turn reads from a business objects methods for custom paged data. When PageIndex is set to any value other than 0 and one of the column headers is clicked for sorting, the pageindex gets reset to 0. I tried to debug it . the PageIndex property of gridview stays the same in the Sorting event of gridview, but I see it changes to 0 in the Selecting event of the...
0
8523
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, 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...
0
8451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8973
Oralloy
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...
1
8683
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,...
0
8722
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7503
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5756
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();...
0
4261
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4468
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.