How can I use the grid to assign data from the client side only?
I want to use if for a shopping cart: I'll add items via javascript to the grid when the user clicks on 'add to cart' for an item. But I'd rather not go back to the server with a postback for cart adds.
so, for example (roughly):
I already know this isn't working, but it gives the sense of what I'd like to do.
Any guidance?
Thanks!
Scott
I want to use if for a shopping cart: I'll add items via javascript to the grid when the user clicks on 'add to cart' for an item. But I'd rather not go back to the server with a postback for cart adds.
so, for example (roughly):
| //...page init... | |
| var items = new Array() | |
| //...elsewhere when add item clicked... | |
| var item = {"PartNumber", partNumber, "Name":partName}; | |
| addToCart(item); | |
| function addToCart(item) { | |
| var cartGrid = $find("cartGridId"); | |
| if(cartGrid) { | |
| items.push(item); | |
| cartGrid.DataSource = items; | |
| } | |
| } |
I already know this isn't working, but it gives the sense of what I'd like to do.
Any guidance?
Thanks!
Scott