User Control Load Problem
-
Hi.. Friends !! I want to refresh my user control after clicking on button... Means, I have a shopping cart page, and when I click on 'Add to Cart' button from GridView, I want to reload my 'CartListing' user control on the same page... Because, When I click on 'add to cart' button, It simply postback the current page, And I can not see the last added product in cart listing user control !! So, I have to dynamically refresh my 'CartListing' user control... And I dont know to to refresh it after clickin on button... So, If you have any idea regarding it, please given me ASAP Thanks in advance !! Bye.. Take care.
Regards, Abhi
-
Hi.. Friends !! I want to refresh my user control after clicking on button... Means, I have a shopping cart page, and when I click on 'Add to Cart' button from GridView, I want to reload my 'CartListing' user control on the same page... Because, When I click on 'add to cart' button, It simply postback the current page, And I can not see the last added product in cart listing user control !! So, I have to dynamically refresh my 'CartListing' user control... And I dont know to to refresh it after clickin on button... So, If you have any idea regarding it, please given me ASAP Thanks in advance !! Bye.. Take care.
Regards, Abhi
-- Abhi -- wrote:
Because, When I click on 'add to cart' button, It simply postback the current page, And I can not see the last added product in cart listing user control !!
This won't be a problem of user control reloading. Web user controls ( ascx files ) are replacement for classical ASP include files. When page posts back, your user control also reloads. If it is not showing the newly added items, that may be some other reason. How you are maintaining the cart ? Is your user control having any
cache
option set ?
-
-- Abhi -- wrote:
Because, When I click on 'add to cart' button, It simply postback the current page, And I can not see the last added product in cart listing user control !!
This won't be a problem of user control reloading. Web user controls ( ascx files ) are replacement for classical ASP include files. When page posts back, your user control also reloads. If it is not showing the newly added items, that may be some other reason. How you are maintaining the cart ? Is your user control having any
cache
option set ?
-
Thanks so much from your reply post... But, the thing is that.. I got solution by other way... Thanks a lot !! Take care.. Bye.
Regards, Abhi
-- Abhi -- wrote:
I got solution by other way...
That's great. Would you mind sharing it here ?
-
-- Abhi -- wrote:
I got solution by other way...
That's great. Would you mind sharing it here ?
Yes. Sure. See, I have a 'CartList' user control. Now, this 'CartList' control contais a 'private void BindCart()' methods that binds the current product items to the grid view those are purchased by client. Now, In my 'ProductListing.aspx' I have to refresh this User Control my 'Add to Cart' button click. Now, What i have done is : 1. I have made 'private void BindCart()' methods to 'public void BindCart()'. So, I have made public methods in my UserControl. 2. I have first of all inserted all product to the 'tblCart' those are purchased by client. 3. Then, I called this Methods on 'Add to Cart' button click event. Ex. ProductCart1.BindGrid(); 4. So, Now I've a refreshed product cart on my same page. That's it. Thanks for this conversation.
Regards, Abhi