Reputation: 116837
I have an EditorTemplate that is repeated on a page. This EditorTemplate creates a Telerik Window (see code below). How do I ensure that only one instance of the PostalLookupWindow
Window is created for a given page/request? I want to re-use this Window for all the EditorTemplates.
I have tried using ViewData and TempData to store temporary values indicating that the control has been created before but was unsuccessful.
I cannot put the Window creation in the controls's parent as the EditorTemplate is re-used in multiple pages.
Html.Telerik().Window()
.Name("PostalLookupWindow")
.Title("Postal Code Selection")
.Height(430)
.Width(700)
.Modal(true)
.Draggable(true)
.Scrollable(false)
.LoadContentFrom(Url.Action("Index","PostalCode", null, Request.Url.Scheme))
.Visible(false).Render();
Upvotes: 0
Views: 517
Reputation: 53183
You could try using HttpContext.Items
to store a value. There is only one instance of that collection for the entire request.
Upvotes: 2