Any possible way?

T

TJ

Hi,

Environment : VS.NET 2005/CF 2.0

DataGrid control is used for Pocket PC application.

Q: is there any way I can hide a row programatically in the datagrid?

The thing I want to achive is to mark deleted row somehow.
Well, I know that I can bind DataTable/DataView object into DataSource...
(I can get the deleted records by fetching RowState.Deleted)

However, I would like to do this with custom objects(custom array)...
Custom arrary objects is bound to datasource in datagrid...
If user clicks the row to delete, I would like to mark somehow...
If I remove it from underlying data strcture, there is no way of knowing,
which one has been deleted...

Well, possibly I can think of three approahces...

1. Hide row from the datagrid. I think this is the best solution I can think
of, as long as the I can keep the state of the underlying data structure..

2. I may be able to design a kind of View class that exposes only needed
data to datasource....I meant....something like DataView....However, it seems
that this approach somewhat more than what I need to do in this app...

3. It could be samething to #2,..I think I can maintain two arraylist to
keep track of current and deleted one...Seems not elegant approach, though...

If you know somehow to hide a row programatically in the datagrid,
please share your idea with us.

Thanks,
 
S

Simon Hart [MVP]

Maybe you should tell us what you are trying to achieve from a functional
business perspective rather than technical perspective, then we maybe able to
offer our advice as I am getting confused as to why you need to "mark"
records that have been deleted.

Cheers
 
T

TJ

Hi,

Sure...
Let me just simply state the question.

I want to achive that when user deletes the record on the datagrid by
tapping some UI, I would like to hide the specific row that has been deleted.
Internal data structure, it will keep track the state, which is like
IsDeleted = true.

Basically, I don't want to show the records that has been deleted by users,
but want to keep that data with some state(like IsDeleted = true in that
object) in that datasoruce of datagrid.

Thanks,
 
S

Simon Hart [MVP]

I don't think this is possible with a DataGrid control using custom
collections. You would have to remove the item from the collection, then
refresh. If you need this state, maybe a work around would be to copy that
record to a deleted collection. Ugly I know, another better solution is to
write your own user drawn control to achieve what you need in a more elegant
solution which is what we do.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com
 
T

TJ

Hi, Thanks for your reply.

Actually, I thought so, too...I wasn't able to find anything for it...Hum...
Do you think that it would be even better we can extend somehow from the
DataGrid class for hiding feature?
I may have to research on it, however, I just would like to have som opinion
on it.

Thanks,
 

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

Top