Hi,
I need to set property for onSortCommand for DataGrid at runtime. I have
the following code:
DataGrid MyDataGrid = new DataGrid();
MyDataGrid.AllowSorting=true;
MyDataGrid.BorderColor="white";
MyDataGrid.CellPadding=4;
MyDataGrid.CellSpacing=0;
MyDataGrid.Width=700;
MyDataGrid.OnSortCommand = MyDataGrid_Sort;
All of the above works except MyDataGrid.OnSortCommand gives me error:
Compiler Error Message: CS0122:
'System.Web.UI.WebControls.DataGrid.OnSortCommand(System.Web.UI.WebControls.DataGridSortCommandEventArgs)' is inaccessible due to
its protection level.
I have the function:
protected void MyDataGrid_Sort(Object Src, DataGridSortCommandEventArgs E).
I don't know how to apply MyDataGrid_Sort function to OnSortCommand.
Please advise me the correct way to set the onSortCommand property.
Thank you in advance.
Timothy