Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi there

 

I use a datagrid to display data from my access db,

 

I have fields such as

 

first name

surname

address1

address2

address3

address4

home phone

work phone

mobile

 

etc,etc

 

I want to display this data in the order of the columns above but when i load the datagrid,it displays the columns in alphabetical order - eg

 

address1

address2

address3

address4

first name

home phone

mobile

work phone

 

is there any way to stop the datagrid sorting my columns ???

Posted

Specify the sorting order desired in your SQL using ORDER BY:

 

SELECT ... FROM ... ORDER BY first name, surname, etc.

 

Then set DataGrid.AllowSorting = False.

  • *Experts*
Posted

It sorts the columns? Do you have any special code to do this? If your SELECT lists out the columns in the order you want, the grid should "honor" that SELECT. As long as you have:

SELECT first name, surname, address1, address2...

and not

SELECT address1, address2, address3, address4, first name...

you should be Ok.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...