Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Set properties at runtime for DataGrid


Message #1 by "Thien Tran" <timtran55@h...> on Sun, 11 Feb 2001 06:45:12
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

  Return to Index