G
Guest
Hello,
Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid
where I want to let the user delete columns. I added a context menu to the
datagrid that has a delete option. If the user right clicks on a column
heading can I highlight that column and then delete it? I'm not exactly sure
how to highlight it or figure out what column has been clicked.
In my testing so far when I use the context menu I always get the error
"Column 'ColumnName' does belong to table" - I'm trying to remove the first
column:
((DataTable)dgdData.DataSource).Columns.RemoveAt(0);
When I added a button and use the same line of code I do not get the error
and the column is removed. Any ideas why?
Thanks for any help, I really appreciate it.
Thanks,
Nick
Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid
where I want to let the user delete columns. I added a context menu to the
datagrid that has a delete option. If the user right clicks on a column
heading can I highlight that column and then delete it? I'm not exactly sure
how to highlight it or figure out what column has been clicked.
In my testing so far when I use the context menu I always get the error
"Column 'ColumnName' does belong to table" - I'm trying to remove the first
column:
((DataTable)dgdData.DataSource).Columns.RemoveAt(0);
When I added a button and use the same line of code I do not get the error
and the column is removed. Any ideas why?
Thanks for any help, I really appreciate it.
Thanks,
Nick