これを試すと
protected void Grid_ViewSorting(Object sender, GridViewSortEventArgs e)
{
DataGrid myGrid = (DataGrid) sender;
DataTable datatable =(DataTable) myGrid.DataSource;
DataView dataView = datatable.DefaultView;
if(e.SortDirection.ToString() == "ASC")
{
dataView.Sort = e.SortExpression + "DESC";
} else
{
dataView.Sort = e.SortExpression + "ASC";
}
}
エラーメッセージ「invalidCastException Was Unhandled By userCode Unable to cast Object OF type 'System.Web.UI.WebControls.GridView' to type 'System.Web.UI.Web.Contro.DataGrid'.