can anyone solve this??

Discussion in 'ASP .Net Datagrid Control' started by G Dean Blake, Jan 15, 2005.

  1. G Dean Blake

    G Dean Blake Guest

    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
    G Dean Blake, Jan 15, 2005
    #1
    1. Advertising

  2. G Dean Blake

    Elton Wang Guest

    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


    >-----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
    >
    >
    >.
    >
    Elton Wang, Jan 16, 2005
    #2
    1. Advertising

  3. G Dean Blake

    G Dean Blake Guest

    no, I did not mis index the column.
    G

    "Elton Wang" <> wrote in message
    news:0acb01c4fc19$c9354530$...
    > 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
    >
    >
    >>-----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
    >>
    >>
    >>.
    >>
    G Dean Blake, Jan 17, 2005
    #3
  4. G Dean Blake

    Elton Wang Guest

    OK.

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

    Hope it's helpful.

    Elton Wang


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

    in message
    >news:0acb01c4fc19$c9354530$...
    >> 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
    >>
    >>
    >>>-----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
    >>>
    >>>
    >>>.
    >>>

    >
    >
    >.
    >
    Elton Wang, Jan 17, 2005
    #4
  5. G Dean Blake

    G Dean Blake Guest

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

    > in message
    >>news:0acb01c4fc19$c9354530$...
    >>> 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
    >>>
    >>>
    >>>>-----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
    >>>>
    >>>>
    >>>>.
    >>>>

    >>
    >>
    >>.
    >>
    G Dean Blake, Jan 18, 2005
    #5
  6. 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" <> wrote in message
    news:%23spsbWP$...
    > 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" <> wrote in message
    > news:0f5c01c4fcc5$5947efa0$...
    >> OK.
    >>
    >> Instead of using
    >> datagrid.Items.Cells(4).Visible, please use
    >> datagrid.Columns(4).Visible
    >>
    >> Hope it's helpful.
    >>
    >> Elton Wang
    >>
    >>
    >>>-----Original Message-----
    >>>no, I did not mis index the column.
    >>>G
    >>>
    >>>"Elton Wang" <> wrote

    >> in message
    >>>news:0acb01c4fc19$c9354530$...
    >>>> 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
    >>>>
    >>>>
    >>>>>-----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
    >>>>>
    >>>>>
    >>>>>.
    >>>>>
    >>>
    >>>
    >>>.
    >>>

    >
    >
    Alvin Bruney [MVP], Jan 18, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ajith Nair
    Replies:
    0
    Views:
    1,621
    Ajith Nair
    Aug 17, 2005
  2. JDS

    Anyone?? Anyone at all??

    JDS, Sep 26, 2005, in forum: HTML
    Replies:
    2
    Views:
    369
    Montgomery BOO...URNS
    Sep 29, 2005
  3. Steve Williams

    Anyone? Anyone?

    Steve Williams, Sep 16, 2003, in forum: Python
    Replies:
    0
    Views:
    373
    Steve Williams
    Sep 16, 2003
  4. shapper
    Replies:
    0
    Views:
    298
    shapper
    May 30, 2007
  5. gregarican

    Anyone, anyone...Bueller?

    gregarican, Jun 22, 2007, in forum: Ruby
    Replies:
    2
    Views:
    84
    gregarican
    Jun 22, 2007
Loading...

Share This Page