473,597 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView SortMode Automatic Doesn't Work

mac
I have a datagridview that I populate with the result of a web service. The
webservice sends multiple rows back with each row as one element of an
array. I use a for loop and the bindingsource.A dd method to get the rows
into the grid.

That all works fine, but at runtime, the grid wont' allow me to sort. I
have used he smarttage to edit the columns and made sure that the sortmode
is set to "Automatic" , but when I click the column header during runtime,
nothing happens.

What am I doing wrong?

Thanks,

Mac
Aug 1 '06 #1
3 12606
Hello mac,
It might be because your business object being returned from the web service
does not support IComparable. The array does support Array.Sort but the underlining
object I believe must support IComparable in order for things to work. I
hope this helps.
Adam Calderon [C# MVP]
http://blogs.interknowlogy.com/adamcalderon
I have a datagridview that I populate with the result of a web
service. The webservice sends multiple rows back with each row as one
element of an array. I use a for loop and the bindingsource.A dd
method to get the rows into the grid.

That all works fine, but at runtime, the grid wont' allow me to sort.
I have used he smarttage to edit the columns and made sure that the
sortmode is set to "Automatic" , but when I click the column header
during runtime, nothing happens.

What am I doing wrong?

Thanks,

Mac

Aug 1 '06 #2
mac
Hi Adam,

Thanks for the info. I'm pretty new to this, so I don't know what
IComparable is. I will take a look on google. Can you give me a two
sentence preview?

Thanks,

Mac

"Adam Calderon" <http://blogs.interknow logy.com/adamcalderon/wrote in
message news:1b******** *************** **@msnews.micro soft.com...
Hello mac,
It might be because your business object being returned from the web
service does not support IComparable. The array does support Array.Sort
but the underlining object I believe must support IComparable in order for
things to work. I hope this helps.
Adam Calderon [C# MVP]
http://blogs.interknowlogy.com/adamcalderon
>I have a datagridview that I populate with the result of a web
service. The webservice sends multiple rows back with each row as one
element of an array. I use a for loop and the bindingsource.A dd
method to get the rows into the grid.

That all works fine, but at runtime, the grid wont' allow me to sort.
I have used he smarttage to edit the columns and made sure that the
sortmode is set to "Automatic" , but when I click the column header
during runtime, nothing happens.

What am I doing wrong?

Thanks,

Mac


Aug 2 '06 #3
Hello mac,

This is from the IComparable Interface entry in the SDK:
This interface is implemented by types whose values can be ordered; for example,
the numeric and string classes.
A value type or class implements the CompareTo method to create a type-specific
comparison method suitable for purposes such as sorting.

This is from the various overloads to Array.Sort in the SDK:
If comparer is a null reference (Nothing in Visual Basic), each element of
array must implement the IComparable interface to be capable of comparisons
with every other element in array.
If the sort is not successfully completed, the results are undefined.
This method uses the QuickSort algorithm. This implementation performs an
unstable sort; that is, if two elements are equal, their order might not
be preserved. In contrast, a stable sort preserves the order of elements
that are equal.
On average, this method is an O(n log n) operation, where n is the Length
of array; in the worst case it is an O(n ^ 2) operation.

Here are some links to the SDK online:
http://msdn2.microsoft.com/en-us/lib...omparable.aspx
http://msdn2.microsoft.com/en-us/lib...rray.sort.aspx

Here are some link to various areas on the net
http://www.c-sharpcorner.com/Languag...parablePSD.asp
http://www.c-sharpcorner.com/UploadF...4-1991fad8affa
Adam Calderon [C# MVP]
http://blogs.interknowlogy.com/adamcalderon
Hi Adam,

Thanks for the info. I'm pretty new to this, so I don't know what
IComparable is. I will take a look on google. Can you give me a two
sentence preview?

Thanks,

Mac

"Adam Calderon" <http://blogs.interknow logy.com/adamcalderon/wrote
in message news:1b******** *************** **@msnews.micro soft.com...
>Hello mac,
It might be because your business object being returned from the web
service does not support IComparable. The array does support
Array.Sort
but the underlining object I believe must support IComparable in
order for
things to work. I hope this helps.
Adam Calderon [C# MVP]
http://blogs.interknowlogy.com/adamcalderon
>>I have a datagridview that I populate with the result of a web
service. The webservice sends multiple rows back with each row as
one element of an array. I use a for loop and the bindingsource.A dd
method to get the rows into the grid.

That all works fine, but at runtime, the grid wont' allow me to
sort. I have used he smarttage to edit the columns and made sure
that the sortmode is set to "Automatic" , but when I click the column
header during runtime, nothing happens.

What am I doing wrong?

Thanks,

Mac

Aug 2 '06 #4

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

Similar topics

7
4881
by: AnnMarie | last post by:
My JavaScript Form Validation doesn't work at all in Netscape, but it works fine in IE. I made some of the suggested changes which enabled it to work in IE. I couldn't make all the changes because then it didn't work in IE. How can I enable this javascipt form validation to work in Netscape? When I use netscape, none of the alert boxes appear. It submits the form without validating anything.
2
1824
by: George Hester | last post by:
I have a page that loads an applet. It's a cube that is used as a navigation menu. This issue actually happens in both Microsoft Internet Explorer and Netscape. All versions that I know of. And also happens with the Microsoft JVM and Sun's JVM. Here's the issue: When the page loads and messages in the status bar about what the applet is doing (like applet initializing that sort of thing) finish, the result when all is said and done is...
5
2740
by: Gary Mayor | last post by:
Hi, If I have the ' character within the javascript:pick command it doesn't work. Is there some sort of way of escaping these characters like in server side languages. function pick(symbol) { if (window.opener && !window.opener.closed) window.opener.document.create.text1.value = symbol; window.close(); }
7
42557
by: Bennett Haselton | last post by:
Is there any way to find a string representing an object's class, which will work in Internet Explorer 6? "typeof" doesn't work -- it returns "object" for all objects: x = window.open('http://www.yahoo.com/'); alert(typeof x); And I found this page: http://www.mozilla.org/js/language/js20-2002-04/core/expressions.html
6
13279
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileID.ToString() + ".pdf");
4
3397
by: bbp | last post by:
Hello, In an ASPX page I have a "Quit" button which make a simple redirect in code-behind. This button doesn't work no more since (I think) I moved from the framework 1.0 to 1.1 and it doesn't work only on IE! My ASPX page works in FireFox. If the button doesn't work it's because of validators (and it worked with the same code in v1.0).
10
1810
by: Sourcerer | last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and tried to run it on my friend's computer (he doesn't have the compiler). We both have Windows XP Professional. I have .NET framework 2.0, and he had 1.0 and it didn't work; then he installed 2.0 and it still didn't work; so he tried with 2.1 and it didn't work, then 3.0 and nothing still worked. I have Intel Centrino Mobile (laptop computer), and he has Intel Pentium...
0
1172
by: frostbb | last post by:
1st I know about the new DataGridView control. For various reasons we need the IsSelected( ) method of the old DataGrid to work in the upgraded apps. I have a small test app that illustrates the problem. The following code works great in C# Net 1.0 & Net 1.1 apps ... doesn't work for Net 2.0 apps. Cannot get pDg.IsSelected(i) to toggle to 'true' for 'highlighted' rows in a DataGrid control.
1
2679
by: windscar | last post by:
Hello Everybody! I am a beginner that try to learn C++ programming. I work in Linux Ubuntu Karmic Koala (9.10) environment. I got a problem with getchar(). The function works well in a simple program. But when I use it in while (cond.) and switch (var.) , the function doesn't work, it doesn't even ask me to input character (including "\n"). Or maybe there are other reasons why getchar() doesn't work. I am sorry if I repost the same...
0
7969
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
7886
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
8272
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...
0
8258
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...
1
5847
isladogs
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...
0
5431
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
3886
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
3927
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1238
bsmnconsultancy
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.