1
Question Body:

This has been a fun week (if you look back at my questions you'll see a common theme).

I have a repeater that is bound to a collection. Each repeater item dynamic control that corresponds to the collection item, it also renders out a header over each control that contains a Delete link.

When the delete link is clicked, the appropriate item is removed from the collection, and the repeater is rebound.

The problem I am encountering is that once I alter the repeater items, the state on some of the usercontrols is lost. Its always the same controls, regardless of where they are in the collection.

I'm wondering if changing the bound collection is a no-no, and it may confuse viewstate from properly restoring the values.

Can anyone clarify? How else can I do this?

Edit
avatar
asked15 years ago

    Leave a Comment

    [named hyperlinks] (https://example.com)
    **bold**
    _italic_

    1 Answer

    0

    Ok, answered my own question.

    The answer is, don't...its a nightmare.

    Instead, I added a softDelete flag, and instead of removing the item from the collection, I just set this flag. Then, the repeater does not render items are marked for deletion.

    When the collection is saved, it discards the items marked for deletion, and saves...

    Everything is fixed, if not in an odd way.

    Edit
    avatar
    answered15 years ago

    Your Answer

    Drop files here or click to upload.
    undraw-questions

    Disilab for your Teams

    – Collaborate and share knowledge with a private group.

    Create a free Team