468,257 Members | 1,415 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

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 3810
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

Post your reply

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

Similar topics

1 post views Thread by jmdolinger | last post: by
13 posts views Thread by Tomasz Jastrzebski | last post: by
1 post views Thread by Terry Olsen | last post: by
reply views Thread by ami | last post: by
1 post views Thread by dorandoran | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.