Sorting dynamically created columns in the datagird

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
 
G

Gaurav Gargate

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top