472,809 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,809 software developers and data experts.

Sorting GRIDVIEW Automatically Asp.net C# (Take a Look Please)

35
I have a Gridview Which as you know it was sorted by Ascending by default.

Now i want Gridview to Sorting Descending On Load,,,

i want somthing like Below:

protected void Page_Load(object sender, EventArgs e)
{
Gridview1.Sortdirection = Descending;
}

Do you understand what im Saying?!

Asp.Net C#

Help Me if you can
Oct 3 '07 #1
4 3976
mzmishra
390 Expert 256MB
This link may help you
http://msdn2.microsoft.com/en-us/library/aa479347.aspx
Oct 3 '07 #2
DAnDA
35
Hi

Look ,,,Theres GrdiView1 , Dropdownlist1 , TextBox1 And a button

Gridview1 Contain "FirstName . LastName" Columns ,,, i want Filter Gridview1 by using DropDownlist1 To Select which Column should be Filter And TextBox1 to define Filter Condition

im Using Asp.Net , C# , SqlDataSource,,,thinkin i Have to use SqlDataSource.FilterExpression Property but dont Know How

Can anyone Help me?
Oct 10 '07 #3
DAnDA
35
Hi

Look ,,,Theres GrdiView1 , Dropdownlist1 , TextBox1 And a button

Gridview1 Contain "FirstName . LastName" Columns ,,, i want Filter Gridview1 by using DropDownlist1 To Select which Column should be Filter And TextBox1 to define Filter Condition

im Using Asp.Net , C# , SqlDataSource,,,thinkin i Have to use SqlDataSource.FilterExpression Property but dont Know How

Can anyone Help me?
Oct 11 '07 #4
dip_developer
648 Expert 512MB
Hi

Look ,,,Theres GrdiView1 , Dropdownlist1 , TextBox1 And a button

Gridview1 Contain "FirstName . LastName" Columns ,,, i want Filter Gridview1 by using DropDownlist1 To Select which Column should be Filter And TextBox1 to define Filter Condition

im Using Asp.Net , C# , SqlDataSource,,,thinkin i Have to use SqlDataSource.FilterExpression Property but dont Know How

Can anyone Help me?
simply use Dataview.....and after filtering the dataview bind this view with your gridview......

here is an example code.....
the code is in vb.net....please convert it to c#....


Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim dv As DataView
  3.    dv = New DataView
  4.    With dv
  5.       .Table = DataSet1.Tables("Suppliers")
  6.       .AllowDelete = True
  7.       .AllowEdit = True
  8.       .AllowNew = True
  9.       .RowFilter = "City = 'Berlin'"
  10.       .RowStateFilter = DataViewRowState.ModifiedCurrent
  11.       .Sort = "CompanyName DESC"
  12.    End With
  13.  
Oct 11 '07 #5

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

Similar topics

0
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update...
3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
1
by: Ram | last post by:
Hi All, I am using Object Data Source to bind data in the gridview. I have set the property AllowSorting=true. While running the application, I could sort the data only in ascending order. Is...
1
by: jmdolinger | last post by:
Hi all, I'm a newbie to Atlas (and recently ASP.NET) after coming from a long Java background, also have done quite a bit with an Ajax.NET/ASP.NET 1.1 project, but it was basically all...
13
by: Tomasz Jastrzebski | last post by:
Helo All, The problem: GridView control does not render at all (header/footer) when the data source is empty. I have seen a similar question posted already, but I just can not believe there is...
1
by: Terry Olsen | last post by:
When I let the GridView automatically generate columns, I can allow sorting. But when I turn autogenerate columns off, it won't allow sorting (column names are not hyperlinks). Is there a way I...
0
by: ami | last post by:
Hi everyone, I have a question about dynamically adding columns to a gridview. Based on user input (after a button click), some columns are being added to my gridview. What I do: ...
1
by: dorandoran | last post by:
The sort on the childgrid is not working; nothing happens when I click on the each column header for sort. (I followed Satay's sample: http://www.codeproject.com/KB/aspnet/EditNestedGridView.aspx)...
1
by: rajkumarbathula | last post by:
Hi I am having a requirement where i have to provide sorting option for gridview in .net C#. when any one clicks on heading of the column, it should automatically sort accordingly. i am not...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.