473,382 Members | 1,622 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,382 software developers and data experts.

Manually sort elements in datagrid

How can I manually sort elements in my datagrid as .NET
places them in alphabetical order ?

G.N
Nov 20 '05 #1
6 1328
As in how can I manually arrange the order of the fields
in my datagrid so that they appear the way I want, not
alphabetical ?

G.N
Nov 20 '05 #2
Are you using WebForms or WindowsForms?

In WindowsForms you can accomplish this by adding a TableStyle to your grid
and putting column definitions in this TableStyle. You can do this quit easy
in the designer.

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Garry Newman" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
As in how can I manually arrange the order of the fields
in my datagrid so that they appear the way I want, not
alphabetical ?

G.N

Nov 20 '05 #3
Hi,

You have to add a tablestyle to the datagrid.
http://msdn.microsoft.com/library/de...asicprimer.asp

Ken
-------------------------------
"Garry Newman" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl...
As in how can I manually arrange the order of the fields
in my datagrid so that they appear the way I want, not
alphabetical ?

G.N

Nov 20 '05 #4
ok I've added a tablestyle to the DataGrid and then added
my fields (in the order I want) as memebers of the
DataGridColumnStyleCollection by setting the Mapping Name
property to the relevant field in my table, but this
doesn't make any difference to the order at runtime, so
I've either missed a step or set the wrong property ???

any ideas

Thanks G.N
Nov 20 '05 #5
Did you set the MappingName of the TableStyle equal to the name of your
DataTable?

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Garry Newman" <an*******@discussions.microsoft.com> wrote in message
news:0a****************************@phx.gbl...
ok I've added a tablestyle to the DataGrid and then added
my fields (in the order I want) as memebers of the
DataGridColumnStyleCollection by setting the Mapping Name
property to the relevant field in my table, but this
doesn't make any difference to the order at runtime, so
I've either missed a step or set the wrong property ???

any ideas

Thanks G.N

Nov 20 '05 #6
Yeah I did that but...

I made two extremely stupid mistakes the first was not to
give the column headers names and the second was not to
fill the dataset these events resulted in instant
confusion and bewilderment

Thanks for your help

G.N
Nov 20 '05 #7

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

Similar topics

0
by: Walt Borders | last post by:
Hi, My problem: Merging two datasets deletes parent elements, preserves all children. I've created two dataSets. Each use the same schema, parent-child nested tables. The first dataSet is...
3
by: | last post by:
Is there an event that is invoked when a user sorts a column in a Windows Forms DataGrid? I have context senstive icons that are enabled\disabled depending upon the selected item in the...
5
by: Bill Todd | last post by:
In a WinForms application with a DataGrid bound to a DataTable, if I change the DefaultDataView.Sort property the order of the data in the grid does not change. If I change the Sort property...
4
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the...
7
by: DC Gringo | last post by:
I have a datagrid that won't sort. The event handler is firing and return label text, just not the sort. Here's my Sub Page_Load and Sub DataGrid1_SortCommand: -------------------- Private...
5
by: Kurt Schroeder | last post by:
I'm using VS.net. I have created a component with the basic set of database commands. This component returns a record set that is bound to a datagrid. I want to add a dynamic sort, but am not sure...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
4
by: Joe | last post by:
Hello, I have a datagrid in an nested html table (one table inside of another table) and have set the allowsSorting property to true. I've created in the code-behind a method (Sub - I'm using...
2
by: shuckjunkmail | last post by:
It was suggested that I re-submit this question as a new post rather than adding onto an old and unanswered post. The basic problem has to do with the .NET datagrid and sorting. I am having...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...

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.