Foretrenty
Programmer
I did not cut and paste actual code as it is too long and contains many other sensitive information. I will try to describe my problem in plain english and psuedocode as below:
I have the following codes:
Private Sub ShowItemDetails(ByVal ItemName)
(Clear page's main updatepanel)
(Create new button "See other products in category")
(AddHandler to button for button.click event to AddressOf Event_ShowProductCategory)
(Draw the updatepanel on client's browser using "UpdatePanel.Update")
End Sub
Private Sub ShowItemCategory(ByVal CategoryName)
(Clear page's main updatepanel)
(Create new imagebutton for each product in the category. They look like thumbnails on the actual page)
(AddHandler to imagebutton for imagebutton.click event to AddressOf Event_ShowProductDetails)
(Create one new button after all the thumbnails is added. The text for the button is "See other categories...")
(AddHandler to button for button.click event to AddressOf Event_ShowProductSummary)
(Draw the updatepanel on client's browser using "UpdatePanel.Update")
End Sub
Private Sub ShowItemSummary()
(Clear page's main updatepanel)
(Create new imagebutton(s) for up to 3 products for each category. So there are up to 3 thumbnails for each category, but all categories are shown on actual page)
(AddHandler to each imagebutton(s) for imagebutton.click event to AddressOf Event_ShowProductDetails)
(Create one new button each category. The text for the button is "See category...", therefore there is one such button for one category. )
(AddHandler to button for button.click event to AddressOf Event_ShowProductCategory)
(Draw the updatepanel on client's browser using "UpdatePanel.Update")
End Sub
Protected Sub Event_ShowProductSummary(ByVal sender As Object, ByVal e As System.EventArgs)
ShowItemSummary()
End Sub
Protected Sub Event_ShowProductCategory(ByVal sender As Object, ByVal e As System.EventArgs)
Dim SourceButton As Button = sender
ShowItemCategory(SourceButton.CommandArgument)
End Sub
Protected Sub Event_ShowProductDetails(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Dim SourceImage As ImageButton = sender
ShowItemDetails(SourceImage.CommandArgument)
End Sub
This is all presented on
I was thinking the problem was maybe about viewstate and dynamic controls. I read about them and I just dont understand where my error is at.
I put tried to put them codes in page load and page init, they all gave me smae result.
Only the summary page when the page first load up works correctly. When you click on "See other products in category" at the product's details page, it goes back to summary. When you click on the thumbnails where you are suppose to go to product details, it goes back to summary again.
Is there a problem where I should not addhandlers in the updatepanel and clear them and add another set of handlers? Are previous handlers cleared when I do updatepanel.ContentTemplateContainer.controls.clear ?
Even if I did not clear the handlers, it should have work. It gives me headaches.. please help.
I have the following codes:
Private Sub ShowItemDetails(ByVal ItemName)
(Clear page's main updatepanel)
(Create new button "See other products in category")
(AddHandler to button for button.click event to AddressOf Event_ShowProductCategory)
(Draw the updatepanel on client's browser using "UpdatePanel.Update")
End Sub
Private Sub ShowItemCategory(ByVal CategoryName)
(Clear page's main updatepanel)
(Create new imagebutton for each product in the category. They look like thumbnails on the actual page)
(AddHandler to imagebutton for imagebutton.click event to AddressOf Event_ShowProductDetails)
(Create one new button after all the thumbnails is added. The text for the button is "See other categories...")
(AddHandler to button for button.click event to AddressOf Event_ShowProductSummary)
(Draw the updatepanel on client's browser using "UpdatePanel.Update")
End Sub
Private Sub ShowItemSummary()
(Clear page's main updatepanel)
(Create new imagebutton(s) for up to 3 products for each category. So there are up to 3 thumbnails for each category, but all categories are shown on actual page)
(AddHandler to each imagebutton(s) for imagebutton.click event to AddressOf Event_ShowProductDetails)
(Create one new button each category. The text for the button is "See category...", therefore there is one such button for one category. )
(AddHandler to button for button.click event to AddressOf Event_ShowProductCategory)
(Draw the updatepanel on client's browser using "UpdatePanel.Update")
End Sub
Protected Sub Event_ShowProductSummary(ByVal sender As Object, ByVal e As System.EventArgs)
ShowItemSummary()
End Sub
Protected Sub Event_ShowProductCategory(ByVal sender As Object, ByVal e As System.EventArgs)
Dim SourceButton As Button = sender
ShowItemCategory(SourceButton.CommandArgument)
End Sub
Protected Sub Event_ShowProductDetails(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Dim SourceImage As ImageButton = sender
ShowItemDetails(SourceImage.CommandArgument)
End Sub
This is all presented on
I was thinking the problem was maybe about viewstate and dynamic controls. I read about them and I just dont understand where my error is at.
I put tried to put them codes in page load and page init, they all gave me smae result.
Only the summary page when the page first load up works correctly. When you click on "See other products in category" at the product's details page, it goes back to summary. When you click on the thumbnails where you are suppose to go to product details, it goes back to summary again.
Is there a problem where I should not addhandlers in the updatepanel and clear them and add another set of handlers? Are previous handlers cleared when I do updatepanel.ContentTemplateContainer.controls.clear ?
Even if I did not clear the handlers, it should have work. It gives me headaches.. please help.