Hi guys!
I am trying to sort the records in my grid view by clicking the Header of any of the columns in my grid view. I read many articles about it and try them according to the instructions. When I tried to put it in codes, there is an error message saying "Object Reference not set to an instance of an object."
Here is my code where the error is. The error part is the line with Asterisks:
private DataView Getdata()
{
connection();
amicassaCon.Open();
DataSet dsMilestone = new DataSet();
string strSelectCmd = "SELECT[milestone_code],[milestone_name],[order_no],[milestone_status] FROM milestone ";
SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, amicassaCon);
da.Fill(dsMilestone, "milestone");
***DataView dvMilestone = dsMilestone.Tables["milsetone"].DefaultView;
dvMilestone.Sort = ViewState["SortExpr"].ToString();
return dvMilestone;
}