A
Alan Silver
Hello,
I have a page in which I'm trying to give the user the chance to
manipulate a list of items. These are the price variations for a
product, so each item consists of a name (eg, small, medium, large), a
price, a checkbox to say whether or not the variation is on special
offer and a special price.
I can pull the values out of the database OK and display them in a
repeater. What I want to do is have a set of controls below the repeater
that allows them to add a new variation. They would fill in the name,
price, etc and click the button. The new variation would be added to the
list and shown in alphabetical order with the other variations.
Not too hard so far, except that I don't want to write anything back to
the database at this stage. I want to keep this all on the page until
they have finished and only then update the database. This is where I
got stuck ;-)
The problem is that in PageLoad I pull the values out of the database
and bung them in the repeater. Subsequent postbacks will just use that
original data. I need a way of keeping the modified data (ie any changed
values, new variations and deleted variations) and displaying those.
I had thought about creating some sort of array or datareader containing
the latest set of values (pulled out of the repeater on postback), then
making any changes, such as removing deleted variations, then adding in
the new variation, then sorting the array and finally binding it to the
repeater. Sounds easy eh? Well I haven't a clue as to how I would do
it!! I'm stuck just deciding which kind of array (or similar) I would
use to store the info, as well as how to store it.
Any idea how I would go about this? Any and all suggestions appreciated.
I have a page in which I'm trying to give the user the chance to
manipulate a list of items. These are the price variations for a
product, so each item consists of a name (eg, small, medium, large), a
price, a checkbox to say whether or not the variation is on special
offer and a special price.
I can pull the values out of the database OK and display them in a
repeater. What I want to do is have a set of controls below the repeater
that allows them to add a new variation. They would fill in the name,
price, etc and click the button. The new variation would be added to the
list and shown in alphabetical order with the other variations.
Not too hard so far, except that I don't want to write anything back to
the database at this stage. I want to keep this all on the page until
they have finished and only then update the database. This is where I
got stuck ;-)
The problem is that in PageLoad I pull the values out of the database
and bung them in the repeater. Subsequent postbacks will just use that
original data. I need a way of keeping the modified data (ie any changed
values, new variations and deleted variations) and displaying those.
I had thought about creating some sort of array or datareader containing
the latest set of values (pulled out of the repeater on postback), then
making any changes, such as removing deleted variations, then adding in
the new variation, then sorting the array and finally binding it to the
repeater. Sounds easy eh? Well I haven't a clue as to how I would do
it!! I'm stuck just deciding which kind of array (or similar) I would
use to store the info, as well as how to store it.
Any idea how I would go about this? Any and all suggestions appreciated.