Last post Apr 08, 2011 08:47 AM by BaconEggAndCheeseSandwich
Mar 25, 2011 09:02 AM|BaconEggAndCheeseSandwich|LINK
My intention is to give the user a flexible user control on a master page that does the following:
This part works fine through the use of a Repeater with a LinkButton contained in an ItemTemplate. The user sees each of the pages he has been visiting in descending order, the provided benefit is a quick way to re-open records they have recently modified
The part I'm having trouble handling is what happens when the user clicks the LinkButton, which is that the child page adds a new reference to the URL at the beginning of the List<> collection and I cannot seem to control the behavior of removing the LinkButton
before it gets re-created. What I've tried doing is:
Repeater1.DataSource = List<>;
While that should work, my CreateBreadCrumb(string url, string title) function gets called by the child page before the UserControl detects the Repeater1_ItemCommand event, so in effect it appears that the wrong ItemIndex is being used for removal. Can anyone
help me to either devise a better solution or solve this problem ?
Thanks in advance
Mar 25, 2011 09:27 AM|tehremo|LINK
How about adding an additional querystring param to the item in the List. Then you can check for this param and not add it back:
Apr 08, 2011 08:47 AM|BaconEggAndCheeseSandwich|LINK
Hi, thanks for the reply.
To solve the problem, I'm just calling RemoveAt(ItemIndex) on the Repeater's ItemCommand event. After removing the item, I redirect the user to the clicked URL and then I re-add the URL on pageload.
I may need to consider an alternative solution down the road, but for now this seems to suffice.