GridView sorting and persisting values

Discussion in 'ASP .Net' started by Carlos, May 16, 2006.

  1. Carlos

    Carlos Guest

    Hi all,

    I currently have a Gridview that doess sorting correctly
    using several fields. However, I do have a checkbox field
    that when it is checked I do not know how to make its
    value to persist when the page is sorted after it is changed.
    I do handle the checkedchanged event, but I do not know
    if it is there that I need to do something with the whole gridview or just
    the checkbox that was checked/unchecked.

    Thanks in advance,

    Carlos.
     
    Carlos, May 16, 2006
    #1
    1. Advertising

  2. Carlos

    PeterKellner Guest

    On Tue, 16 May 2006 10:43:11 -0400, "Carlos" <>
    wrote:

    >Hi all,
    >
    > I currently have a Gridview that doess sorting correctly
    >using several fields. However, I do have a checkbox field
    >that when it is checked I do not know how to make its
    >value to persist when the page is sorted after it is changed.
    >I do handle the checkedchanged event, but I do not know
    >if it is there that I need to do something with the whole gridview or just
    >the checkbox that was checked/unchecked.
    >
    >Thanks in advance,
    >
    > Carlos.
    >


    Is your checked column bound to a data column? Or, Did you add that
    column dynamically?

    Peter Kellner
    http://peterkellner.net
     
    PeterKellner, May 16, 2006
    #2
    1. Advertising

  3. Carlos

    Carlos Guest

    Hi Peter,

    thanks for your reply. Yes, the column is bound to a bit field, and I am
    able to
    place its mark on the page (i.e. does not disappear), the problem is that
    when
    I sort any of the columns, I miss its value because the viewstate is saved
    during the not postback inside the page load event..

    Thanks again,

    Carlos

    "PeterKellner" <> wrote in message
    news:...
    > On Tue, 16 May 2006 10:43:11 -0400, "Carlos" <>
    > wrote:
    >
    >>Hi all,
    >>
    >> I currently have a Gridview that doess sorting correctly
    >>using several fields. However, I do have a checkbox field
    >>that when it is checked I do not know how to make its
    >>value to persist when the page is sorted after it is changed.
    >>I do handle the checkedchanged event, but I do not know
    >>if it is there that I need to do something with the whole gridview or just
    >>the checkbox that was checked/unchecked.
    >>
    >>Thanks in advance,
    >>
    >> Carlos.
    >>

    >
    > Is your checked column bound to a data column? Or, Did you add that
    > column dynamically?
    >
    > Peter Kellner
    > http://peterkellner.net
     
    Carlos, May 16, 2006
    #3
  4. Carlos

    PeterKellner Guest

    On Tue, 16 May 2006 12:51:04 -0400, "Carlos" <>
    wrote:

    >Hi Peter,
    >
    > thanks for your reply. Yes, the column is bound to a bit field, and I am
    >able to
    >place its mark on the page (i.e. does not disappear), the problem is that
    >when
    >I sort any of the columns, I miss its value because the viewstate is saved
    >during the not postback inside the page load event..
    >
    >Thanks again,
    >
    > Carlos
    >
    >"PeterKellner" <> wrote in message
    >news:...
    >> On Tue, 16 May 2006 10:43:11 -0400, "Carlos" <>
    >> wrote:
    >>
    >>>Hi all,
    >>>
    >>> I currently have a Gridview that doess sorting correctly
    >>>using several fields. However, I do have a checkbox field
    >>>that when it is checked I do not know how to make its
    >>>value to persist when the page is sorted after it is changed.
    >>>I do handle the checkedchanged event, but I do not know
    >>>if it is there that I need to do something with the whole gridview or just
    >>>the checkbox that was checked/unchecked.
    >>>
    >>>Thanks in advance,
    >>>
    >>> Carlos.
    >>>

    >>
    >> Is your checked column bound to a data column? Or, Did you add that
    >> column dynamically?
    >>
    >> Peter Kellner
    >> http://peterkellner.net

    >


    Carlos,

    I've spent some time now trying to understand the behavior I'm seeing.
    I assume you are using the SqlDataSource control. When I use that,
    and bind it to a bit column (sqlserver2005), it shows text in the
    columns (TRUE or FALSE). Very strange. Not what I would expect.

    Truthfully, I almost never use sqldatasource. I always use strongly
    typed dataset's which I find much easier and more flexible. I tried
    the same thing with that, and bound it to an ObjectDataSource and the
    behavior was exactly as I would have expected.

    The bit column shows as a radio button, and editing works correctly,
    and sorting maintains correctly as you would expect. (the update
    event must do a databind under the covers for us to the viewstate).

    At anyrate, I'm puzzled. I'll keep poking around. Hopefully on your
    second post, someone who knows more than me will chime in.

    Peter Kellner
    http://peterkellner.net
     
    PeterKellner, May 17, 2006
    #4
    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. John

    Persisting values on a webform

    John, Oct 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    397
    Xavier Pacheco
    Oct 10, 2004
  2. Server Control
    Replies:
    4
    Views:
    771
  3. Carlos
    Replies:
    0
    Views:
    357
    Carlos
    May 16, 2006
  4. Falcolas
    Replies:
    3
    Views:
    254
    Bruno Desthuilliers
    Nov 5, 2007
  5. Replies:
    3
    Views:
    261
    Dennis Lee Bieber
    Nov 21, 2007
Loading...

Share This Page