Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > can anyone solve this??

Reply
Thread Tools

can anyone solve this??

 
 
G Dean Blake
Guest
Posts: n/a
 
      01-15-2005
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


 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      01-16-2005
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
http://www.velocityreviews.com/forums/(E-Mail Removed)

>-----Original Message-----
>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
>
>
>.
>

 
Reply With Quote
 
 
 
 
G Dean Blake
Guest
Posts: n/a
 
      01-17-2005
no, I did not mis index the column.
G

"Elton Wang" <(E-Mail Removed)> wrote in message
news:0acb01c4fc19$c9354530$(E-Mail Removed)...
> 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 Removed)
>
>>-----Original Message-----
>>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
>>
>>
>>.
>>



 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      01-17-2005
OK.

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

Hope it's helpful.

Elton Wang
(E-Mail Removed)

>-----Original Message-----
>no, I did not mis index the column.
>G
>
>"Elton Wang" <(E-Mail Removed)> wrote

in message
>news:0acb01c4fc19$c9354530$(E-Mail Removed)...
>> 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 Removed)
>>
>>>-----Original Message-----
>>>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
>>>
>>>
>>>.
>>>

>
>
>.
>

 
Reply With Quote
 
G Dean Blake
Guest
Posts: n/a
 
      01-18-2005
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

"Elton Wang" <(E-Mail Removed)> wrote in message
news:0f5c01c4fcc5$5947efa0$(E-Mail Removed)...
> OK.
>
> Instead of using
> datagrid.Items.Cells(4).Visible, please use
> datagrid.Columns(4).Visible
>
> Hope it's helpful.
>
> Elton Wang
> (E-Mail Removed)
>
>>-----Original Message-----
>>no, I did not mis index the column.
>>G
>>
>>"Elton Wang" <(E-Mail Removed)> wrote

> in message
>>news:0acb01c4fc19$c9354530$(E-Mail Removed)...
>>> 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 Removed)
>>>
>>>>-----Original Message-----
>>>>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
>>>>
>>>>
>>>>.
>>>>

>>
>>
>>.
>>



 
Reply With Quote
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      01-18-2005
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
"G Dean Blake" <(E-Mail Removed)> wrote in message
news:%23spsbWP$(E-Mail Removed)...
> 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
>
> "Elton Wang" <(E-Mail Removed)> wrote in message
> news:0f5c01c4fcc5$5947efa0$(E-Mail Removed)...
>> OK.
>>
>> Instead of using
>> datagrid.Items.Cells(4).Visible, please use
>> datagrid.Columns(4).Visible
>>
>> Hope it's helpful.
>>
>> Elton Wang
>> (E-Mail Removed)
>>
>>>-----Original Message-----
>>>no, I did not mis index the column.
>>>G
>>>
>>>"Elton Wang" <(E-Mail Removed)> wrote

>> in message
>>>news:0acb01c4fc19$c9354530$(E-Mail Removed).. .
>>>> 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 Removed)
>>>>
>>>>>-----Original Message-----
>>>>>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
>>>>>
>>>>>
>>>>>.
>>>>>
>>>
>>>
>>>.
>>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control. Please, does anyone knows how to solve this? Thank You! shapper ASP .Net 0 05-30-2007 11:48 AM
Can anyone solve these problems?? Kevin Wainhouse Computer Information 3 10-23-2004 02:21 AM
Anyone know how to solve this problem? Sleepyz Computer Support 3 10-12-2004 01:18 AM
anyone can solve my issue Abdul Cisco 0 08-02-2004 06:25 AM
Anyone know how to solve this Word problem ? rita goldman Computer Support 0 07-22-2004 11:24 PM



Advertisments