can anyone solve this??

G

G Dean Blake

This datagrid (dgbudgets) binds perfectly and column4 is a non visible
column.
Immediately after the bind, however, column(4).visible is true both in the
grid and the
grid retrieved from the session variable. This is my first mystery - it
should be
false and the column does indeed not show.

private sub Page_Load.....
if not isPostBack then
daBudgets.Fill(dsBudgets1)
dgbudgets.DataBind()
Session("myGrid") = dgbudgets
Dim anotherGrid As DataGrid = Session("myGrid")
Dim myboolean2 As Boolean = anotherGrid.Items(0).Cells(4).Visible
Dim myboolean1 As Boolean = dgbudgets.Items(0).Cells(4).Visible
..
..
In the following click event, however myboolean1 is still true but
myboolean2 is False
(as it should be). The mystery here is how did it become true (as it should
have been)
since it was retrieved from the very same session variable??

Private sub button1_Click......
Dim anotherGrid As DataGrid = Session("myGrid")
Dim myboolean2 As Boolean = anotherGrid.Items(0).Cells(4).Visible
Dim myboolean1 As Boolean = dgbudgets.Items(0).Cells(4).Visible

Can anyone help me solve this mystery?
hope so,
G
 
E

Elton Wang

Since you mentioned the column4 does not show, so
apparently it's Visible is false. I suppose you might miss
index the column. I mean you might try to check column
(3).visible.

Elton Wang
(e-mail address removed)
 
G

G Dean Blake

no, I did not mis index the column.
G

Elton Wang said:
Since you mentioned the column4 does not show, so
apparently it's Visible is false. I suppose you might miss
index the column. I mean you might try to check column
(3).visible.

Elton Wang
(e-mail address removed)
 
E

Elton Wang

OK.

Instead of using
datagrid.Items.Cells(4).Visible, please use
datagrid.Columns(4).Visible

Hope it's helpful.

Elton Wang
(e-mail address removed)
 
G

G Dean Blake

You are right! the columns().visible is reliable. Also I was having a
problem with the right alignments not showing but
dgbudgets.Columns(7).ItemStyle.HorizontalAlign is also reliable.

Thanks, this has been bugging me for some time. How is it that the
items.cells() info is not reliable?
G
 
A

Alvin Bruney [MVP]

it may be that this is an autogenerated datagrid with a few columns added in
as well? If that's the case, then the cells count will not be based on the
cells in the grid.

--
Regards,
Alvin Bruney

Coming this month
The Microsoft Office Web Components Black Book with .NET
http://tinyurl.com/27cok
 

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

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top