ASPX templates
Version 6.x > ASPX templates > Setting CMSRepeater Path from code-behind View modes: 
User avatar
Member
Member
robert-tailor.co - 9/18/2012 5:53:48 PM
   
Setting CMSRepeater Path from code-behind
Whatever I set a CMSRepeater 'Path' property to in the Code-behind is ignored when my page is rendered.

Why?

How do I set the 'Path' property of a CMSRepeater to ensure the correct path is used?

User avatar
Member
Member
kentico_michal - 9/19/2012 7:48:56 AM
   
RE:Setting CMSRepeater Path from code-behind
Hi,

Please try to call the repeaterID.ReloadData(true) method after you set the Path property.

Best regards,
Michal Legen

User avatar
Member
Member
robert-tailor.co - 10/9/2012 3:02:21 PM
   
RE:Setting CMSRepeater Path from code-behind
kentico_michal wrote: Hi,

Please try to call the repeaterID.ReloadData(true) method after you set the Path property.

Best regards,
Michal Legen

Hi,

What does the boolean 'forceReload' parameter do? If I set it to 'false' the method doesn't appear to do anything.

The documentation describes this parameter as follows:

"Loads data from the according to the current values of properties."

What does that mean?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/9/2012 10:43:12 PM
   
RE:Setting CMSRepeater Path from code-behind
Hi,

The parameter tells whether the data should be reloaded or not. If you set it to false, the data are not reloaded for given control.

User avatar
Member
Member
robert-tailor.co - 10/10/2012 8:31:12 PM
   
RE:Setting CMSRepeater Path from code-behind
kentico_jurajo wrote: Hi,

The parameter tells whether the data should be reloaded or not. If you set it to false, the data are not reloaded for given control.

OK, thanks Juraj.

Sorry if this is another dumb question, but isn't:

repeaterID.ReloadData(false)

the same as simply not calling ReloadData() in the first place?

Also, (and again, apologies if this is dumb question) in what kind of scenario would you want to explicitly *not* ReloadData()? Can you give an example?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/12/2012 2:08:11 AM
   
RE:Setting CMSRepeater Path from code-behind
Hi,

I see now - this is telling whether you want to load the data from the DB or not. If set to true, you are reloading the data from the DB - so you have the actual data. If set to false, you are just loading the data - e.g. in case there is some callback or something similar and the data were not changed, you just need to load them again and do not need to go to the DB again. I hope it makes sense.

Best regards,
Juraj Ondrus