Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a web site that includes two pages. one of them shows my basket (basket.aspx) and the other shows the product(product.aspx). I want to update grid view in basket page when the users click on each products when they buy them.
I test this solution but this code doesn't work for me.

ASP.codebehind_files_default2_aspx page = new ASP.codebehind_files_default2_aspx();

after ASP. a message VS just show the name of my page and global.asax.I was searching in Google and the other codes just say the name of the page and define a variable to calls its method, but in my website i can't do that.

So How can i do that? :(

share|improve this question

2 Answers

Probably it is a better idea to have the content of the basket stored somewhere else (Database, Session, file ).

Let's assume it s a database table.

  • Make the Basket.aspx simply show all what is in the basket table from it's own codebehind.
  • Make the Project.asxp insert the product to the basket table.

This way your presentation is more separated from your business logic

share|improve this answer
thank you for your reason . i show basket.aspx in iframe in master page. i can show the whole basket when i put its grid view in update panel and refresh it in each 6 second, but i think it is better to update the grid view when new product add to basket . but i don't know how? – hony 6 hours ago

if you make the basket a user control it will become easier to handle than an iframe (which, without going into great detail is rather frowned upon). You can put the user control on the master page and you will be able to access the user control's methods (think add/remove item). As Pleun mentions, the basket data should be stored somewhere else and the basket user control will just be displaying that data.

Here is some information on user controls:

  1. User control shopping cart
  2. Accessing a user control in a master page
  3. Overview of user controls
share|improve this answer
Thank you for your reason . I have a question: If my basket (as user control) appears in another page can i call its method?(like fillGridView() or ...) ? – hony 5 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.