GridView sorting and persisting values

C

Carlos

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.
 
P

PeterKellner

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
 
C

Carlos

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
 
P

PeterKellner

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

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
 

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,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top