Ask a Question related to ASP.NET General, Design and Development.
-
Teo Lachev #1
Output Caching for Dynamically Loaded User Controls
Hi,
How can I cache the output of user controls that are loaded dynamically
using LoadControl?
I have an aspx page which loads dynamically user controls under different
conditions as follows:
private void Page_Load(object sender, System.EventArgs e)
{
if (Page.IsPostBack)
{
switch (ucName.ToUpper())
{
case "HOME":
ucName = "Home/Home.ascx"; break;
case "SERVICES":
ucName = "Services/Services.ascx"; break;
...
}
}
UserControl userControl = (UserControl) LoadControl(ucName);
placeHolder.Controls.Add(userControl);
}
I would like to cache the output of the controls using OutputCache directive
or programatically. Currently, if I enable output caching in the user
controls, only the fist one gets loaded (its Page_Load event executed). When
I request another control it doesn't get loaded and its Page_Load doesn't
fire. For example, when I request the page for the first time, the Home user
control gest successfully loaded, but when the page posts back and requests
"Services", the Services user control never gets shown. Instead the Home
user control output is shown.
I tried overriding the control UniqueID property and assign diffrent IDs for
the controls, as well as casting to PartialCachingControl, but it didn't
help.
Teo Lachev Guest
-
datalist dynamically loaded template with user control
I would like to load my templates for my datalist programmatically using loadtemplate. In the edititemtemplate, I have a web user control that... -
Passing Parameters to User Controls that are Dynamically Loaded in Placeholders
Hi Guys, I have been having a big problem with trying to pass parameters into a user control when the user control is dynamically loaded into a... -
Properties for User Controls loaded Programmatically
I have x number of user controls that have a strong type (e.g. className uc1). I am able to access their properties through a single aspx page... -
Refer to a custom property of a dynamically loaded user control
I have an app where I dynamically load a user control based on the type of data it is rendering. There are some standard custom properties that I... -
Keeping track of which user controls need to be loaded and which not
Hi all, What methods are used to keep track of when dynamic user controls must be loaded and when not? Regards John.



Reply With Quote

