DynamicContent RadListView Cache Substitution
I have an auto-generated dynamic widget that I did some customization on top of for the requirement of making items randomly sort every time a page refresh happens.
I was hoping to be able to re-bind the data after it has been sorted within RenderCacheSubstitutionMarkup, but now realize that you cannot do that. Is there a way for me to pass the collection back through the RadListView to output the item templates or do I literally need to do something with StringBuilder to mockup up my entire template?
If you want to use the cache substitution, you should return the markup to be rendered as a string. This way it could be substituted with the markup initially rendered and still keep the other page content cached. You can try creating a new control on the fly and rendering it in a an html text writer to get the markup. However, I will recommend using different approaches for your scenario.
One of them is to override the dynamic content view control and randomize the items shown. They will be cached by the output cache, but the cache will be invalidated ones a new item is added or modified. This will not exactly do what you want, since the content will not be random ordered on each request to the page, but you can do it on a database query level and take huge advantage of the output cache. You can also try invalidate the cache on session start, so when a user starts browsing the site the items are randomized.
Another option is to not cache the page at all, doing it on a page level from the advanced settings or from the response context from inside the widget. You can also use client side binding and retrieving the items using service, instead of doing it server side from the control.