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

sorting is not working

Hi,
I'm using below code for sorting,paging..but sorting is not working
Expand|Select|Wrap|Line Numbers
  1.  
  2. protected void grids(object sender, GridViewPageEventArgs e)
  3. {
  4. std= txtstd.text;
  5. gs= txtgs.text;
  6. if (std== "a")
  7. {
  8. std= "";
  9. }
  10. if (gs== "b")
  11. {
  12. gs= "";
  13. }
  14. string tech= txttech.Text.Trim();
  15. string cl= txtloc.Text.Trim();
  16. DataSet ds = bL.getdet(std, gs, tech, cl);
  17. grid.DataSource = ds.Tables[0];
  18. grid.PageIndex = e.NewPageIndex;
  19. grid.DataBind();
  20. }
  21.  
  22.  
  23. protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
  24. {
  25. if (e.CommandName.ToString() != "Page")
  26. {
  27. }
  28. }
  29.  
  30. protected void grid_Sorting(object sender, GridViewSortEventArgs e)
  31. {
  32. std= txtstd.text;
  33. gs= txtgs.text;
  34. if (std== "a")
  35. {
  36. std= "";
  37. }
  38. if (gs== "b")
  39. {
  40. gs= "";
  41. }
  42. string tech= txttech.Text.Trim();
  43. string cl= txtloc.Text.Trim();
  44. DataSet ds = bL.getdet(std, gs, tech, cl);
  45. grid.DataSource = ds.Tables[0];
  46. grid.Sort = e.SortExpression;
  47. grid.DataBind();
  48.  
  49. }
  50.  
May 30 '08 #1
2 1104
kunal pawar
297 100+
Problem is in ur sorting event, after fired sort event u have to toggle e.direction. and for that purpose u have to use Dataview
May 30 '08 #2
Frinavale
9,735 Expert Mod 8TB
Hi,
I'm using below code for sorting,paging..but sorting is not working
Expand|Select|Wrap|Line Numbers
  1.  
  2. protected void grid_Sorting(object sender, GridViewSortEventArgs e)
  3. {
  4. std= txtstd.text;
  5. gs= txtgs.text;
  6. if (std== "a")
  7. {
  8. std= "";
  9. }
  10. if (gs== "b")
  11. {
  12. gs= "";
  13. }
  14. string tech= txttech.Text.Trim();
  15. string cl= txtloc.Text.Trim();
  16. DataSet ds = bL.getdet(std, gs, tech, cl);
  17. grid.DataSource = ds.Tables[0];
  18. grid.Sort = e.SortExpression;
  19. grid.DataBind();
  20.  
  21. }
  22.  
What are:
txttech, txtloc, txtstd and txtgs?
Why are they in your sort method??

Anyways, you are not using the GridView's sort method correctly.
Please see MSDN for the correct way to use the Gridview.Sort Method.

-Frinny
May 30 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

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...
4
by: John Bullock | last post by:
Hello, I am at wit's end with an array sorting problem. I have a simple table-sorting function which must, at times, sort on columns that include entries with nothing but a space (@nbsp;). I...
2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
7
by: Foodbank | last post by:
Hi everyone. I'm having trouble with this radix sorting program. I've gotten some of it coded except for the actual sorting :( The book I'm teaching myself with (Data Structures Using C and...
19
by: Owen T. Soroke | last post by:
Using VB.NET I have a ListView with several columns. Two columns contain integer values, while the remaining contain string values. I am confused as to how I would provide functionality to...
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...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
2
by: Simon | last post by:
Hi, I have a table I am populating with data from a DB, and have it sortable on the client side. When the table exceeds around 300 rows, I start running into problems with rendering and sorting...
1
KevinADC
by: KevinADC | last post by:
Introduction In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar...
5
by: lemlimlee | last post by:
hello, this is the task i need to do: For this task, you are to develop a Java program that allows a user to search or sort an array of numbers using an algorithm that the user chooses. The...
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
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.