Hello,<BR><BR>I have been struggling with a datagrid problem for a few days now and am hoping someone can shed some light for me. I am adding a datagrid to a webform dynamically via code-behind. I am not initially adding a datagrid to the aspx page, this is done based on user inputs. There could be zero grids added or there can be many. <BR><BR>The problem I am having is with sorting. I can&#039;t seem to find a way to set the OnSortCommand method for the datagrid that I create in the code-behind file. Without setting this method, I have no way of telling the datagrid where to look for the code to fire when a column is sorted.<BR><BR>Is there a way around this... am I missing something simple?<BR><BR>Thanks,<BR>Cory<BR>