Sorting dynamically created columns in the datagird

  • Thread starter Thread starter Gaurav Gargate
  • Start date Start date
G

Gaurav Gargate

To Group,

I am creating a datagrid in an ASP.NET project (C#) at the design time.
I will be adding the columns to the datagird at run time.
The number of columns, name of the columns, data in the rows etc. will all
be decided on the run time.
I am using the simple grid.Columns.Add(BoundColumn).... method.

BUT I am not able to sort these columns even if the AllowSorting property
has been set to true.
I cannot capture any event when I click the header of the data grid.
The page is posted back on clicking the header but no event is fired.

How can I sort the columns created on the run time.

Thanks in Advance,
Gaurav
 
Hi Srini...

Thanks for the urgent reply.
Infact I had tried out everything that is displayed on the link you
sent. Just forgot to mention that in my post.. :-(

The problem was that the dynamically generated columns on the datagrid
did not generate/evoke any event. So was not able to catch any of them.

I have however found a way round. I have allowed the auto creation of
columns on the datagrid and bound the data grid to the dataset I get.
This has resulted in dynamic columns, as well as all the events are been
captured.

Regards,
Gaurav
 
Back
Top