Correct Answer : Use DataViev object with each sort
Explanation :
DataView.Sortproperty allow you to sort data. Using a DataView, you can show the data in a table with different sort orders.
Example : In this example our table name is StudentMaster.
public partial class Default5 : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("provide connection string");
SqlDataAdapter da;
protected void Page_Load(object sender, EventArgs e)
{
string query = "select * from StudentMaster";
da = new SqlDataAdapter(query, con);
DataSet ds = new DataSet();
da.Fill(ds);
DataView dv = new DataView();
dv = ds.Tables[0].DefaultView;
dv.Sort = "studName";
DataTabledt = dv.Table;
GridView1.DataSource = dt;
GridView1.DataBind();
}
}