Ultragrid - looping to hide columns

Ross & Steven,



Thanks for the code. Worked great!



Kevin Simon



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
Ross Hughes
Sent: Monday, August 16, 2010 1:52 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Ultragrid - looping to hide columns





Hi Kevin,

Try this:

For Each column As UltraGridColumn In grid.DisplayLayout.Bands(0).Columns
column.Hidden = True
Next

Then turn back on as required.

Ross

-----Original Message-----
From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf Of
ksimon8fw
Sent: Monday, August 16, 2010 11:22 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Ultragrid - looping to hide columns

I have added an ultragrid to a form, and assigned it a datasource. However,
as a default, it shows all fields from the datasource. On this application,
there are only a few fields that I want to display, so I would like to loop
through all the columns, hide them, then go back and unhide the select few
for display.

Right now, I am having to add a line such as this:
epiGrd.DisplayLayout.Bands(0).Columns("Number02").Hidden = True
for each field I want to hide. I'd like to add some type of code that does
the following:

For Each ColumnName in .....
epiGrd.DisplayLayout.Bands(0).Columns(ColumnName).Hidden = True
next

then, I would go back and set the hidden attribute to false on the few I
want displayed.

Has anyone done anything like this?

Thanks.
Kevin Simon

------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
<http://groups.yahoo.com/group/vantage/files/>
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links





[Non-text portions of this message have been removed]
I have added an ultragrid to a form, and assigned it a datasource. However, as a default, it shows all fields from the datasource. On this application, there are only a few fields that I want to display, so I would like to loop through all the columns, hide them, then go back and unhide the select few for display.

Right now, I am having to add a line such as this:
epiGrd.DisplayLayout.Bands(0).Columns("Number02").Hidden = True
for each field I want to hide. I'd like to add some type of code that does the following:

For Each ColumnName in .....
epiGrd.DisplayLayout.Bands(0).Columns(ColumnName).Hidden = True
next

then, I would go back and set the hidden attribute to false on the few I want displayed.

Has anyone done anything like this?

Thanks.
Kevin Simon
Hi Kevin,

Try this:

For Each column As UltraGridColumn In grid.DisplayLayout.Bands(0).Columns
column.Hidden = True
Next

Then turn back on as required.

Ross


-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
ksimon8fw
Sent: Monday, August 16, 2010 11:22 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Ultragrid - looping to hide columns

I have added an ultragrid to a form, and assigned it a datasource. However,
as a default, it shows all fields from the datasource. On this application,
there are only a few fields that I want to display, so I would like to loop
through all the columns, hide them, then go back and unhide the select few
for display.

Right now, I am having to add a line such as this:
epiGrd.DisplayLayout.Bands(0).Columns("Number02").Hidden = True
for each field I want to hide. I'd like to add some type of code that does
the following:

For Each ColumnName in .....
epiGrd.DisplayLayout.Bands(0).Columns(ColumnName).Hidden = True
next

then, I would go back and set the hidden attribute to false on the few I
want displayed.

Has anyone done anything like this?

Thanks.
Kevin Simon



------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
Here is some code I have on one of my forms that does that:

for each item as UltraGridColumn in ugdEpiCustom2.Rows.Band.Columns
If item.datatype.ToString = "System.String" Then
item.Nullable = 2
End If
item.Hidden = True
Next
ugdEpiCustom2.Rows.Band.Columns("Key1").Hidden = False
ugdEpiCustom2.Rows.Band.Columns("Key2").Hidden = False
ugdEpiCustom2.Rows.Band.Columns("Character01").Hidden = False
ugdEpiCustom2.Rows.Band.Columns("Date01").Hidden = False
ugdEpiCustom2.Rows.Band.Columns("Checkbox01").Hidden = False
ugdEpiCustom2.Rows.Band.Columns("Key1").Header.Caption = "Customer"
ugdEpiCustom2.Rows.Band.Columns("Key2").Header.Caption = "State"
ugdEpiCustom2.Rows.Band.Columns("Character01").Header.Caption = "Tax Exempt
Number"
ugdEpiCustom2.Rows.Band.Columns("Date01").Header.Caption = "Expires On"
ugdEpiCustom2.Rows.Band.Columns("CheckBox01").Header.Caption = "Not Tax Exempt"
Â
The item.Nullable is for string columns. If you don't set it to 2, null values
can cause a problem for Vantage. After I hide all the columns, I unhide the
ones I want and then set the column headers.



________________________________
From: ksimon8fw <ksimon8fw@...>
To: vantage@yahoogroups.com
Sent: Mon, August 16, 2010 12:21:33 PM
Subject: [Vantage] Ultragrid - looping to hide columns

Â
I have added an ultragrid to a form, and assigned it a datasource. However, as a
default, it shows all fields from the datasource. On this application, there are
only a few fields that I want to display, so I would like to loop through all
the columns, hide them, then go back and unhide the select few for display.


Right now, I am having to add a line such as this:
epiGrd.DisplayLayout.Bands(0).Columns("Number02").Hidden = True
for each field I want to hide. I'd like to add some type of code that does the
following:


For Each ColumnName in .....
epiGrd.DisplayLayout.Bands(0).Columns(ColumnName).Hidden = True
next

then, I would go back and set the hidden attribute to false on the few I want
displayed.


Has anyone done anything like this?

Thanks.
Kevin Simon







[Non-text portions of this message have been removed]