0

We use Page.ParseControl to interpret a string of XML into controls. Does it use some kind of caching mechanism? If not - is there a way to cache its result?

Page.LoadControl seems to support some sort of caching.

Kees C. Bakker
  • 32,294
  • 27
  • 115
  • 203

2 Answers2

1

There does not seem to be any caching involved. As a Control is a reference types, caching wouldn't be recommended in this case. (You want a new instance of the control each time you call the ParseControl function)

Kees C. Bakker
  • 32,294
  • 27
  • 115
  • 203
Magnus
  • 45,362
  • 8
  • 80
  • 118
1

LoadControl doesn't perform caching per say, but the difference is rather that ParseControl will parse the input string every time to create the control dynamically, while LoadControl will re-use the parsed control template and class type when creating new instances, making it an order of magnitude faster.

Kees C. Bakker
  • 32,294
  • 27
  • 115
  • 203
PjL
  • 982
  • 7
  • 10