Make columns (fields) invisible dynamically?

G

Guest

I have posted my question before. It seems that I can not find the solution.
The question:
I have datasource, say, ds which is bounded to a datagrid, dg.
Assume that ds have 5 columns, c0,c1,c2,c3,c4.
In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use
c3 and c4 in code behind.
In case 2, I want to display column c0, c3, and c4, and use c1 and c2 in
code behind.

The following Possible solution do not work:
dg.Column(3).Visible = false.

My analysis from the test: dg.Column(3).Visible = false is only working for
those columns which are defined in design by DataGrid Property Builder. If
you populate a table to the datagrid via binding programmatically, it does
not work, at least in my computer.

Any good solution for it?

Thanks

David
 
G

Guest

I have played your example. It is a very good example to help me for other
checkbox control of cell in a datagrid. I will check your code.

By the way, when you drag the datagrid from toolbox, have you unchecked any
property for it?

Thanks

David
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top