P
psb
imagine a shopping cart application. I am on the product details page.
this page has a cart summary on the right hand side of the page. the cart
summary is a webcontrol that sits in the aspx page like this:
<GSG:CARTSUMMARY id="CartSummary" runat="server"></GSG:CARTSUMMARY>
in this webcontrol is a datagrid of all items in the cart. this particular
application has a Max Order Quantity Limit. At the bottom of the product
details page is a textbox for quantity to order and a submit button. The
submit button has to check 2 things.
1. is clng(txbQuantity.Text) > 0 AND
2. is clng(txbQuantity.Text) + lngQtyInCart > MaxOrderQuantity.
lngQtyInCart could be retreived from the database, but I was getting
creative and didn't want to have to do similar lookups since the cart
quantity is already on the page in the cartsummary control. SO, onthe
btnSubmit_Serverclick() event, I find the control and loop through the items
in the datagrid. I find the quantity and do the math. works very nicely.
Here is where the problem comes in. If I click the "submit" button too
fast. I get an error: "Object reference not set to an instance of an
object." It can't find the cartsummary control, like it hasn't loaded yet.
has anyone seen this before?? I think I will just go straight to the
database.
thanks in advance for any responses...
this page has a cart summary on the right hand side of the page. the cart
summary is a webcontrol that sits in the aspx page like this:
<GSG:CARTSUMMARY id="CartSummary" runat="server"></GSG:CARTSUMMARY>
in this webcontrol is a datagrid of all items in the cart. this particular
application has a Max Order Quantity Limit. At the bottom of the product
details page is a textbox for quantity to order and a submit button. The
submit button has to check 2 things.
1. is clng(txbQuantity.Text) > 0 AND
2. is clng(txbQuantity.Text) + lngQtyInCart > MaxOrderQuantity.
lngQtyInCart could be retreived from the database, but I was getting
creative and didn't want to have to do similar lookups since the cart
quantity is already on the page in the cartsummary control. SO, onthe
btnSubmit_Serverclick() event, I find the control and loop through the items
in the datagrid. I find the quantity and do the math. works very nicely.
Here is where the problem comes in. If I click the "submit" button too
fast. I get an error: "Object reference not set to an instance of an
object." It can't find the cartsummary control, like it hasn't loaded yet.
has anyone seen this before?? I think I will just go straight to the
database.
thanks in advance for any responses...