473,385 Members | 2,274 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 Data

Below is the code iam using to sort the data when i click the button links.
The problem is every time I click the button link, the code is connecting to database and sorting.How can I modify the code below so that everytime I click it should not connect to database and at the same time sort.

Expand|Select|Wrap|Line Numbers
  1.  public void ID_click(object s, EventArgs e)
  2.     {
  3.  
  4.         Sort("XX " + state);
  5.     }
  6.  
  7.  
  8.  
  9.     public void NM_Click(object s, EventArgs e)
  10.     {
  11.         Sort("XX " + state);
  12.     }
  13.  
  14.  
  15. public void Sort(string strSort)
  16.     {
  17.       OracleConnection conn = new OracleConnection(GetConnectionString());
  18.  
  19.       OracleCommand cmd = new OracleCommand("Stored Proc", conn);
  20.       cmd.CommandType = CommandType.StoredProcedure;
  21.       cmd.Parameters.Add("Number", OracleType.Char, 7).Value = "1234";
  22.       cmd.Parameters.Add("cursor", OracleType.Cursor).Direction = ParameterDirection.Output;
  23.  
  24.       OracleDataAdapter da = new OracleDataAdapter(cmd);
  25.       DataSet ds = new DataSet();
  26.       DataView objDV = new DataView();
  27.       DataTable objDT = new DataTable();
  28.  
  29.           da.Fill(ds);
  30.           objDT = ds.Tables[0];
  31.           objDV = ds.Tables[0].DefaultView;
  32.           objDV.Sort = strSort;
  33.           Repeater1.DataSource = objDV;
  34.           Repeater1.DataBind();
  35.  
  36.  
  37.       conn.Close();
  38.     }
Jan 19 '08 #1
2 968
kenobewan
4,871 Expert 4TB
Prevent the postback, try using if !(page.ispostback) in you sort function. HTH.
Jan 19 '08 #2
Prevent the postback, try using if !(page.ispostback) in you sort function. HTH.
Can you please explain in detail what you have said.?
Jan 19 '08 #3

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

Similar topics

7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
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...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
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...
10
by: Sjaakie | last post by:
Hi, I'm, what it turns out to be, fooling around with 3-tier design. At several websites people get really enthusiastic about using custom dataobjects instead of datasets/-tables. While trying to...
4
by: kurt sune | last post by:
I have a an aspx page with a gridview. The gridview is data bound to a generic list of custom classes. The gridview's DataSource is thus not set. Now I want to add sorting to it. So I create...
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...
3
KevinADC
by: KevinADC | last post by:
If you are entirely unfamiliar with using Perl to sort data, read the "Sorting Data with Perl - Part One and Two" articles before reading this article. Beginning Perl coders may find this article...
6
by: =?Utf-8?B?RGFu?= | last post by:
I am reposting a question from about 3 weeks ago ("sorting capability"). I have an aspx page in which I get the data from a database dynamically, through C# code, by creating a dynamic table...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.