473,406 Members | 2,549 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,406 software developers and data experts.

Sorting of datagrid column

I set the datagrid to be sortable,
sort expression = "Column1 asc"

but when i click the column name
the datagrid doesn't load anything, did i miss sth. on the sorting? thanks a
lot!!

in Sort_Command event handler

Dim SortView As DataView = DataSet11.Products.DefaultView
SortView.Sort = e.SortExpression
DataGrid1.DataSource = SortView
DataGrid1.DataBind()

Nov 19 '05 #1
2 1282
I am not sure how your entire code look like.
I suggest you to take a look at this small example in below article.
http://www.dotnetjunkies.com/Article...0D57699C3.dcik

Sachi

"alan" wrote:
I set the datagrid to be sortable,
sort expression = "Column1 asc"

but when i click the column name
the datagrid doesn't load anything, did i miss sth. on the sorting? thanks a
lot!!

in Sort_Command event handler

Dim SortView As DataView = DataSet11.Products.DefaultView
SortView.Sort = e.SortExpression
DataGrid1.DataSource = SortView
DataGrid1.DataBind()

Nov 19 '05 #2
i am using asp.net (VB), and Access Database
i make the connection and make a datagrid from the OleDbAdaptor

I tick "allow sorting" and enter "colName asc" as sort expression the
property builder of the datagrid

i want to use the "dataview" approach to sort the columns
if i add "if not me.ispostback", nothing will be loaded after click the
column head
if not add, the column will give no response even i click the column head

thanks a lot!

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
datgrid1.DataBind()
End Sub

in Sort_Command event handler

Dim SortView As DataView = DataSet11.Products.DefaultView
SortView.Sort = e.SortExpression
DataGrid1.DataSource = SortView
DataGrid1.DataBind()
"Sachi" wrote:
I am not sure how your entire code look like.
I suggest you to take a look at this small example in below article.
http://www.dotnetjunkies.com/Article...0D57699C3.dcik

Sachi

"alan" wrote:
I set the datagrid to be sortable,
sort expression = "Column1 asc"

but when i click the column name
the datagrid doesn't load anything, did i miss sth. on the sorting? thanks a
lot!!

in Sort_Command event handler

Dim SortView As DataView = DataSet11.Products.DefaultView
SortView.Sort = e.SortExpression
DataGrid1.DataSource = SortView
DataGrid1.DataBind()

Nov 19 '05 #3

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

Similar topics

1
by: Sargas Atum | last post by:
Hi all, 1. I have a problem with cell selection in a table in a DataGrid. I dont want that anybody writes in the cells. That was not a problem I changed them to "read only", but if I am going...
3
by: melanieab | last post by:
Hi, I'm programatically sorting in a datagrid. When a column header is clicked, the sort happens twice for some reason, making it looks like it only sorts in descending order. I can tell it...
0
by: Robert Brinson | last post by:
Hello all! I'm running .NET Framework 1.1 using VS.NET 2003. I've got a mystery with a DataGrid. Below is the definition of the DataGrid from my aspx page: </asp:datagrid><asp:datagrid...
4
by: Richard | last post by:
When i try sorting in the database, it sorts the numbers: 0 1 102 2 304 305 4 etc....
11
by: rkbnair | last post by:
I have created a datagrid in my aspx with the 'AllowSorting' property to true. When clicking on the column header, the page refreshes. However the sorting is not done. Am I missing anything? I...
2
by: saleek | last post by:
Hi, I am trying to figure out why my datagrid has stopped firing the page and sort commands. Scenario: I originally had template columns in my datagrid and had set up custom bi-directional...
2
by: Lars Netzel | last post by:
I have a Datagrid using the Edit/Update mode to alter data in the datasource. I needed to have a bit more flexible interface in the editmode with a design that couldn't work in the columns. So I...
8
by: simchajoy2000 | last post by:
I thought the only thing I had to do to disable column sorting in VB.NET was to set datagrid.AllowSorting = False. Unfortunately this has never worked for me. I discovered another set of code...
4
by: Ambica Jain | last post by:
Hi, I want custom sorting on some of the columns in the datagrid. And i am able to do the same by overriding MouseDown event. However, i need to rebind my datatable to reflect the changes in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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...
0
jinu1996
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...
0
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...
0
agi2029
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,...
0
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...

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.