I'm using the DefaultView from the Datasource for a DataGrid to
present the data in a particular order. It seems that sorting in this
way is an "Active Sort", as is the default sort that is provided by
clicking on a column header. By "Active Sort", I mean that editing a
value in a sorted column may cause the record to be moved to maintain
the sort order.
Is there an efficient way to present the data in a given order but not
have it be an "Active Sort." That is, I don't want records jumping
around to different places because the value in a sorted column has
been edited. I also need to allow a user to select which column the
grid is sorted on by clicking on the column header.
Thanks Much,
Gene H. 5 2223
"Gene Hubert" <gw******@hotma il.com> wrote in message
news:7e******** *************** ***@posting.goo gle.com... Is there an efficient way to present the data in a given order but not have it be an "Active Sort." That is, I don't want records jumping around to different places because the value in a sorted column has been edited. I also need to allow a user to select which column the grid is sorted on by clicking on the column header.
Thanks Much, Gene H.
Only to feed it a data source which is pre-sorted as desired. The jumping
can't be prevented once a column header has been clicked, though, and some
data in that column edited.
The DataGrid should allow you to click on column headings and sort... The
property is AllowSorting, but I can't recall the default value at the
moment.
Does this help any?
Best Regards,
Andy
Thanks Andy. That 'bout what I figured.
Is there a way to bulk move records from one datatable to another?
Here's what I'm doing now, a record at a time...
Dim dt, dtSort As DataTable
Dim dv As DataView
Dim dr As DataRow
....do a bunch of stuff to load dt...
dv = dt.DefaultView 'set initial display order
dv.Sort = "Sort ASC, Name ASC"
dtSort = dt.Clone 'copy datatable structure
dtSort.DefaultV iew.Sort = Nothing 'remove the sort
For Each dr In dt.Select 'move the data
dtSort.ImportRo w(dr)
Next
FileList.DataSo urce = dtSort
"Andy Becker" <x@x.com> wrote in message news:<Or******* ******@TK2MSFTN GP10.phx.gbl>.. . "Gene Hubert" <gw******@hotma il.com> wrote in message news:7e******** *************** ***@posting.goo gle.com... Is there an efficient way to present the data in a given order but not have it be an "Active Sort." That is, I don't want records jumping around to different places because the value in a sorted column has been edited. I also need to allow a user to select which column the grid is sorted on by clicking on the column header.
Thanks Much, Gene H.
Only to feed it a data source which is pre-sorted as desired. The jumping can't be prevented once a column header has been clicked, though, and some data in that column edited.
The DataGrid should allow you to click on column headings and sort... The property is AllowSorting, but I can't recall the default value at the moment.
Does this help any?
Best Regards,
Andy
"Gene Hubert" <gw******@hotma il.com> wrote in message
news:7e******** *************** ***@posting.goo gle.com... Thanks Andy. That 'bout what I figured.
Is there a way to bulk move records from one datatable to another?
I haven't ever used it (yet), but it looks like you can just use
DataTable.Copy. In your particular case, it may be approriate to sort the
copy instead of the other way around, to leave an unsorted DefaultView
behind... But I don't know much about the application. :-)
Best Regards,
Andy
I couldn't get it to work using datatable.copy. It seems that if the
datatable has data in it, and then you change the sort property, the
data is immediately reshuffled.
If you copy the data using datatable.copy, the sort property of the
target datatable is set to empty string, but the data in it does not
present in the sort order of the source datatable used in the copy.
Gene H.
"Andy Becker" <x@x.com> wrote in message news:<OS******* *******@TK2MSFT NGP11.phx.gbl>. .. "Gene Hubert" <gw******@hotma il.com> wrote in message news:7e******** *************** ***@posting.goo gle.com... Thanks Andy. That 'bout what I figured.
Is there a way to bulk move records from one datatable to another?
I haven't ever used it (yet), but it looks like you can just use DataTable.Copy. In your particular case, it may be approriate to sort the copy instead of the other way around, to leave an unsorted DefaultView behind... But I don't know much about the application. :-)
Best Regards,
Andy
"Gene Hubert" <gw******@hotma il.com> wrote in message
news:7e******** *************** ***@posting.goo gle.com... I couldn't get it to work using datatable.copy. It seems that if the datatable has data in it, and then you change the sort property, the data is immediately reshuffled.
If you copy the data using datatable.copy, the sort property of the target datatable is set to empty string, but the data in it does not present in the sort order of the source datatable used in the copy.
Gene H.
I don't think I was very clear in expressing my thoughts. If it is still of
use to you, the idea was to pull rows into a datatable with the required
sort already present, i.e. an "order by" clause. Then copy this to another
datatable and sort as needed.
Are you trying to make a copy of the row in their natural (unsorted) order?
Best Regards,
Andy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bruce Pullum |
last post by:
I have a datagrid that I am using a DataView with. All works great for the
sorting of the columns. However, after I sort the column, and then try and
select a data row to edit, the row selected represents the indes of the
actual DataGrid and not the DataView. For example.. Lets say I have 4 rows
of data.. In the 4 rows I have an Appt Num of 1,2,3,4... Each representing
a data row... I sort DESC so the rows display 4,3,2,1... If I...
|
by: Martin Schmid |
last post by:
I am trying to implement a DataView for a DataGrid so I can sort at runtime
by clicking on column headers. My initial page load works... it displays
the data However, when I click a column heading at run time, the data
doesn't sort as expected, in fact, the DataGrid becomes empty, all I see are
column headings:
SqlConnection sqlConnection;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected ProjContMan.dsProjByDate...
|
by: Rakesh |
last post by:
Using the BindingContext we will be able to find the
actual position of the row selected in a DataView
(regardless of the sort used).
What I want to do is exactly the reverse. That is, I know
the actual position of the row in the BindingContext, and
from that I want to know the position of the same in a
dataview/datagrid. Is this possible?
The reason why I want to do this is becuase of the
|
by: Michał Januszczyk |
last post by:
Is it possible somehow to retreive {data Key Value} based on clicked
{datagrid item index} ? Now i'm trying to do this in the following way, but
with no effect.
Now, Instead of getting value according to specified sort key i get wrong data
HandleInnerDGRControlItemClick(Object sender, DataGridCommandEventArgs args)
{
int clickedIndex = args.Item.ItemIndex;
|
by: troyblakely |
last post by:
I am having trouble sorting a datagrid. I have read numerous posts on
this and other lists, and tried most of the suggestions, but none of
them have worked for me yet. I populate a dataset from two queries,
then I want to sort the data and bind it to a datagrid. Regardless of
what I have tried, the datagrid is populated with the unsorted data.
Any assistance you have would be appreciated.
I have attempted the sort using the dataview.sort...
| |
by: Steve |
last post by:
I have a form with a dataset and a datagrid.
I created a dataview on this dataset.
When the user modifies the datagrid, I look up this record in the dataview
to make sure it is unique.
Here is the confusion.........
I thought that the DataView is the view from the dataset, but it seems that
the dataview has the records that are in the datagrid, because everytime I
search for a record that I know is NOT in the dataset, it finds it. I...
|
by: Aaron Smith |
last post by:
Dim dv As DataView = New DataView(FacilitiesDS1.Facilities, "", "ID
ASC", DataViewRowState.CurrentRows)
Dim iPos As Integer = dv.Find(dr.Item("ID"))
Me.BindingContext(FacilitiesDS1, "Facilities").Position = iPos
That is the code.. dr is DataRow. If dr.Item("ID") = 3, the find will
return position 0, which it should have been 1, and if the ID = 2, it
will return 1, which should have been 0.. The DA has a connection string
that sorts it...
|
by: enceladus311 |
last post by:
I'm trying to find a way to keep from having to fill a DataView after
every PostBack to a page. Basically, the design is that I have a
DataView that I fill, which I then set as the DataSource to a DataGrid
on my page. This works well, however, like I said, I would like to
keep from having to fill the DataView on each PostBack. So, naturally,
what I did was checked whether or not the request was a PostBack by
checking the IsPostBack...
|
by: Nathan Franklin |
last post by:
Hello Guys,
I have been trying to work this our for so long, but I just can't seem to
find the answer.
I am loading a datatable from a an access database using an
oledbdataadapter. I then assign the datatable.dataview to my
datagrid.datasource member so it will display my results..
I need to give the user an option to change the order of this data, I have a
|
by: babis |
last post by:
I work with .NET2003 C# windows form application, i add a datagrid in my form like this:
dataGridProduct.DataSource = dataViewProduct;
I also make the allowSort property of the datagrid set to be true. Here is my problem, i want to make when i click one of the datagrid cell, said there're ProductID or ProductName, i also show it in my textBoxProductID or textBoxProductName. If i don't have sorting, and i click in the datagrid cell, i...
|
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: 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: 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: 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: 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...
| |