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

grid view sorting problem

I have a grid view that pulls data from a dbf file. I set the Allow Sorting
to true and I put my code in the Sorting event.

The problem is that I can't get the sorting to work so I wrote some info to
a text file to see what is happening. What I found out is that when I
clicked on a column to sort it the Sorting function was continuously being
called thus causing the Default Application Pool in IIS to stop.

Here is the code I am using

protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
try
{
using (StreamWriter sw = new
StreamWriter("c:\\agserror\\mapMaker.log", true))
{
// Add some text to the file.
sw.WriteLine(DateTime.Now + " : " + e.SortExpression);
sw.WriteLine(DateTime.Now + " : " + e.SortDirection);
}
if (e.SortDirection == SortDirection.Ascending)
{
e.SortDirection = SortDirection.Descending;
}
else
{
e.SortDirection = SortDirection.Ascending;
}
GridView1.Sort(e.SortExpression, e.SortDirection);
GridView1.DataBind();
}
catch (Exception x)
{
using (StreamWriter sw = new
StreamWriter("c:\\agserror\\mapMaker.log", true))
{
// Add some text to the file.
sw.WriteLine(DateTime.Now + " : " + x.Message);
sw.WriteLine(x.StackTrace);
}
}
}

Any help would be appreciated

Jun 7 '07 #1
1 4128
On Jun 7, 3:40 pm, bbdobuddy <bbdobu...@discussions.microsoft.com>
wrote:
I have a grid view that pulls data from a dbf file. I set the Allow Sorting
to true and I put my code in the Sorting event.

The problem is that I can't get the sorting to work so I wrote some info to
a text file to see what is happening. What I found out is that when I
clicked on a column to sort it the Sorting function was continuously being
called thus causing the Default Application Pool in IIS to stop.

Here is the code I am using

protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
....
GridView1.Sort(e.SortExpression, e.SortDirection);

Hmm.. in the "Sorting" event, which fires before a grid is to be
sorted, you tell the grid to sort itself?

Dont you see that as something like calling Button1.PerformClick()
inside the Click() event of Button1?

Jun 7 '07 #2

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

Similar topics

5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
10
by: John Wilson | last post by:
My app produces some long datatables to display in a grid. So I put them in a div so users can scroll. But the grid headers scroll out of view. I would like to stop them doing this. Can I fix them...
0
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another...
1
by: puja | last post by:
hi all, am using grid view in asp.net 2.0 . My problem is easy but can't get it to work. My grid view id = grdContract and am binding grid view using dataset My dataset returns 5 columns from...
2
by: Umeshnath | last post by:
Hi, I have placed a grid view inside Atlas panel. On click of a button event, data is populated in the grid view, I want to add scroll bar instead of increasing the size of grid view. I have...
0
by: Zuhaib Hyder | last post by:
how can i sort my grid view widout using data source ......... i have binded my grid view wid coding ( using code smith )...... ????????
0
by: allan.s.palmer | last post by:
Hi everyone, I have a generic List<that is bound to a grid view and I want to enable sorting. I have enabled sorting on the GridView, and have set my sort expressions for the each property of...
15
by: Gilles Ganault | last post by:
Hello Since Python is such a productive language, I'd really like to be able to use it to write GUI apps for Windows, but business apps require rich widgets like (DB)grids, calendars, etc. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.