User Control Not Updating

J

Jon

Hi,
using vb.net/vs 2003/sql server 2000

Working on a shopping cart app. I've got a user control that appears on
every page to give a summary of the users shopping cart, eg You have 12
items in your cart, the total is £123.45, this is populated with a stored
procedure that just returns itemcount and itemtotal as output params. This
works fine. On the shopping cart page itself I use a datagrid to list out
the users cart contents and allow him to update quantity or delete an item
from the cart(set quantity to 0). However when a user updates the cart the
user control does not update to reflect the new quantities until either
going to another page or reloading the cart page. It seems that what I need
is something like
if cart has been updated then
refresh the user control

Any suggestions? I'm very new to asp.net - obviously :)

Cheers,
Jon
 
M

Martin Dechev

Hi, Jon,

If you have a reference to the usercontrol and you can access this reference
in the method that updates the cart then use this reference to call some
method that will update the usercontrol.

Something like (the class of the page that updates the cart):

//the reference:
protected CartDisplayUserControl control1;

//the event handler for the "Update" button
protected void HandleUpdateClick(object s, EventArgs e)
{
// process here...

// force the control to refresh:
control1.SomeMethodThatRefreshesIt();
}

Greetings
Martin
 

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

Similar Threads


Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top