For performance reasons i can not set a sort order on a dataset returned from
a stored procedure. Ideally in the sp i'd set the company name as the order
and just load the gridview, however the joins are very complicated and this
causes the sp to take 20 time (at least) longer than when no ordering is
specified. I would create a temp table and sort this for the return, however,
ado.net can not see a temp table because it does not exist at the conclustion
of the sp. I REALLY do not want to use an inline adhoc query that joins 15
table and uses derived result sets to get all the information. The sp
performs very well so long as no attempt to order the result is made.
So here is my issue:
I need to set the default order to company name on the result set on initial
datagrid load. Is there a way to do this? And where? and How?
I think this one is an issue some others have faced and i'd really like you
help.
Thanks!
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes 4 10921
1. Create a "DataView" from your "DataSource "
2. Set the sort order and/or filters in the DataView. (see the .Sort
and .RowFilter properties)
3. Bind the dataview (not the datasource) to your GridView
will sorting then be handled as usual or are there extra steps needed when a
column is selected for alternate sorting such as the older datagrid?
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
"GroupReade r" wrote:
1. Create a "DataView" from your "DataSource "
2. Set the sort order and/or filters in the DataView. (see the .Sort
and .RowFilter properties)
3. Bind the dataview (not the datasource) to your GridView
When the user clicks on a column (to sort that column), you'll have to
handle the appropriate "sorting" event.
In the "sorting" event-handler, you need to:
- requery the data
- create a dataView from the dataset or datatable
- set the sorting on the dataview
- bind the dataview to the grid
Additionally, there are steps you need to take to set the correct up/
down arrow in the grid column header if you want a graphic to show
which column is sorted. Some people use images. Some people use
these unicode chars:▲" and "▼" to show up/down arrows. For
compatibility reasons, the images are best. I don't have the code in
front of me, but I remember being very "surprised" at how not-so-easy
this was.
ok same as a datagrid.
thnaks
kes
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
"GroupReade r" wrote:
When the user clicks on a column (to sort that column), you'll have to
handle the appropriate "sorting" event.
In the "sorting" event-handler, you need to:
- requery the data
- create a dataView from the dataset or datatable
- set the sorting on the dataview
- bind the dataview to the grid
Additionally, there are steps you need to take to set the correct up/
down arrow in the grid column header if you want a graphic to show
which column is sorted. Some people use images. Some people use
these unicode chars:â–²" and "â–¼" to show up/down arrows. For
compatibility reasons, the images are best. I don't have the code in
front of me, but I remember being very "surprised" at how not-so-easy
this was.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mcollier |
last post by:
I have some VB6 code that calls a SELECT query in Microsoft Access.
When I run the query from access, the results appear in not particular
order. However, when I call the query from VB6, via ADO, the rows are
returned in order by one particular column/field. There is no ORDER BY
on the query.
For example, in Access, the rows may be returned as:
RowID
------
1
|
by: Daves |
last post by:
I have a gridview displaying News items and fetches the data through a
(little complicated) sql stored procedure... The sorting seems to be done in
the gridview since there is no sorting implementation in the stored proc
(well actually it is sorted by DateIn DESC by default but still the gridview
by default displays the items as sorted by DateIn ASC by default!!). The
user can then use the gridview's built in sort function to sort after...
|
by: Morten |
last post by:
Hi!
I'm using a gridview to display properties for a number of custom made
objects. E.g. "firstname" and "lastname" of a user object. I'd like to be
able to sort my object list based on which header the user clicks. The
built-in functionality to do this isn't avaliable so I guess I'll have to
write some code to do this. Could someone provide an example of the code
that I need to add to the Sorting event handler to have my gridview sort...
|
by: CSharpguy |
last post by:
I have a grid on my webform with 10 columns, I need to allow the user to sort
the columns when they click on the header. My grid is populated byt a dataset
and not any typed datasets, sqlobjectdatasource, etc. I've looked in some of
the asp.net 2005 books i have on this and the examples dont' work. can
someone show me a working code snippet of sorting a gridview?
|
by: keithb |
last post by:
I have a working ASP.NET 2.0 application that uses a GridView control. How
can I enable the feature that allows a user to click on a column heading and
sort the contents by the information in that column?
Thanks,
Keith
| |
by: rmgalante |
last post by:
Hi,
I've been experimenting with the ASP.Net GridView and encountered some
interesting issues that I thought I would share. I have a page that
loads a GridView with a generic collection of objects. For the purposes
of this discussion, the objects define a Customer, and have an id and a
name.
I want to sort these customers by id or by name in ascending and
descending order. Here is what I did to make it work.
|
by: Mehdi6002 |
last post by:
Hi Guys,
How can I sort my GridView if I bind it to a business object ???
My Object Data Source selected method returns a collection of my business object as follows:
public Collection<TeamsRow> GetTeamsColl(){ ...}
Now, the GridView Automatic only works for DataView, DataTable and DataSet. How can I get it to work with my business object.
|
by: ntuyen01 |
last post by:
Hi All,
Is there a way to make the first row in the Girdview as my default
select row, with the highlight color.
Thanks and Regards
|
by: Peter |
last post by:
I have a GridView which is populated by List<ofObjects>
Does anyone have example of how to sort the columns of this GridView?
I have found examples without DataSourceControl but these use DataTable, I
am using List of Objects.
Here's one example:
http://ryanolshan.com/technology/gridview-without-datasourcecontrol-datasource/
|
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: 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,...
| |
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: 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...
|
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...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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...
| |