Subscribe to Subscribers

Forums » .NET » .NET »

Prevent the ascending order in datagridview


Posted Date: 08 Sep 2012      Posted By:: Gopi A     Member Level: Silver    Member Rank: 350     Points: 1   Responses: 3



Hi,

In database the data's are in normal order. But while view in datagridview it has been getting ascending. I want the data's as it is in database. How can change this in C# for windows application.

adp = new OleDbDataAdapter("select * from food_test", conn);

ds = new DataSet();

adp.Fill(ds);

dataGridView1.DataSource = ds.Tables[0];

-----------------------------------------------------------------------------
Regards,
Gopi A.
+91 9894315571
Skype:gopi.net




Responses

#688150    Author: SQL Programmers      Member Level: Gold      Member Rank: 175     Date: 10/Sep/2012   Rating: 2 out of 52 out of 5     Points: 2

Call this function, to stop sorting option which exists in DataGridView control


protected void dataGridView1(object sender, GridViewSortEventArgs e)
{
e.Cancel = true;
}

SQL Server Programmers and Consultants
http://www.sql-programmers.com/


 
#688534    Author: Gopi A      Member Level: Silver      Member Rank: 350     Date: 12/Sep/2012   Rating: 2 out of 52 out of 5     Points: 1

Hi

I am working in windows application. There is no gridviewsorteventargs. Since this is web application event. Could you let me know for windows application.

-----------------------------------------------------------------------------
Regards,
Gopi A.
+91 9894315571
Skype:gopi.net


 
#688545    Author: Gopi A      Member Level: Silver      Member Rank: 350     Date: 12/Sep/2012   Rating: 2 out of 52 out of 5     Points: 1

Hi,

I have found the same question in another thread. But it's not work for me.

http://www.dotnetspider.com/forum/299943-How-avoid-sorting-datagridview-column-onclick-column-header.aspx

I am using visual studio 2010.

I am getting the below error.

-----------------------------------------------------------------------------
Regards,
Gopi A.
+91 9894315571
Skype:gopi.net






 
Post Reply
You must Sign In to post a response.

Next : Vb.Net program stucked. i need a help to solve errors
Previous : How are modules divided in realtime project
Return to Discussion Forum
Post New Message
Category:

Related Messages

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Talk to Webmaster Tony John
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2013 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.