Hello Sir,
Below is my code
protected void gridContact_Sorting(object sender, GridViewSortEventArgs e)
{
string sortingDirection = string.Empty;
if (dir == SortDirection.Ascending)
{
dir = SortDirection.Descending;
sortingDirection = "Desc";
}
else
{
dir = SortDirection.Ascending;
sortingDirection = "Asc";
}
string id = Session["id"].ToString();
if (Convert.ToInt32(id) < 9999)
{
DataView sortedView = new DataView(BindContactsFree());
sortedView.Sort = e.SortExpression + " " + sortingDirection;
gridCompany.DataSource = sortedView;
gridCompany.DataBind();
}
else
{
DataView sortedView = new DataView(BindContacts());
sortedView.Sort = e.SortExpression + " " + sortingDirection;
gridCompany.DataSource = sortedView;
gridCompany.DataBind();
}
}
public SortDirection dir
{
get
{
if (ViewState["dirState"] == null)
{
ViewState["dirState"] = SortDirection.Ascending;
}
return (SortDirection)ViewState["dirState"];
}
set
{
ViewState["dirState"] = value;
}
}
i am getting error is
CS1502: The best overloaded method match for 'System.Data.DataView.DataView(System.Data.DataTable)' has some invalid arguments
at line
DataView sortedView = new DataView(BindContactsFree());
Please help me sir