Click here to Skip to main content
16,015,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to apply sorting in grid view field through codebehind.

and my gridview code is:
C#
SqlDataAdapter da = new SqlDataAdapter("select * from newcustomer ", con);
            con.Open();
            DataTable ds = new DataTable();
            da.Fill(ds);
            GridView1.DataSource = ds;
            GridView1.DataBind();
            con.close();
Posted
Updated 17-Sep-12 5:00am
v2

1 solution

 
Share this answer
 
v2
Comments
AmitGajjar 17-Sep-12 2:50am    
5+, Also give some solution with LINQ, if data is already exist and just need to sort then linq is best.
__TR__ 17-Sep-12 5:46am    
Thanks :)
Mohamed Mitwalli 17-Sep-12 11:00am    
5+
__TR__ 17-Sep-12 11:37am    
Thanks Mohamed :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900