How to pass rendering parameters for a static controller renderingCustom controller being overwritten by IoCI need to integrate a controller from a compiled dll into a controller I can build/control. How can I call that as a rendering?@Html.Sitecore.Field is not rendering any valuesHow to make two controller renderings working on same page to preserve tracking?Sitecore 9 Platform Essentials Module 7 - Error Rendering Controller: Related Events when using an Edit FrameBase Controller in HabitatHow to Connect controller rendering with Interface TemplateFieldRenderer.Render for controller Rendering not “working”Sitecore support for async controller renderingsSitecore 8.1 Controller Rendering Error
Is this standard Japanese employment negotiations, or am I missing something?
Why do Martians have to wear space helmets?
Minor differences between two recorded guitars
How predictable is $RANDOM really?
How to pass rendering parameters for a static controller rendering
Machine Learning Golf: Multiplication
What is the maximum amount of diamond in one Minecraft game?
Cycles one side transparency
How to supply water to a coastal desert town with no rain and no freshwater aquifers?
How would a sea turtle end up on its back?
When is one 'Ready' to make Original Contributions to Mathematics?
How to say "just a precision" properly in English?
Is conquering your neighbors to fight a greater enemy a valid strategy?
How to delete multiple process id of a single process?
Did William Shakespeare hide things in his writings?
Can you take the Dodge action while prone?
Any way to meet code with 40.7% or 40.44% conduit fill?
Why does "sattsehen" take accusative "mich", not dative "mir"? Even though it is not "me" that I'm looking at?
Text under an arrow without braces
What's the big deal about the Nazgûl losing their horses?
Soda water first stored in refrigerator and then outside
Examples of fluid (including air) being used to transmit digital data?
How do I check that users don't write down their passwords?
SOQL Query (or other means) to get the icon assigned to an object
How to pass rendering parameters for a static controller rendering
Custom controller being overwritten by IoCI need to integrate a controller from a compiled dll into a controller I can build/control. How can I call that as a rendering?@Html.Sitecore.Field is not rendering any valuesHow to make two controller renderings working on same page to preserve tracking?Sitecore 9 Platform Essentials Module 7 - Error Rendering Controller: Related Events when using an Edit FrameBase Controller in HabitatHow to Connect controller rendering with Interface TemplateFieldRenderer.Render for controller Rendering not “working”Sitecore support for async controller renderingsSitecore 8.1 Controller Rendering Error
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
There is need to load a controller rendering from the Razor view.
I'm doing it this way:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
Here Captcha is the controller name, GoogleReCaptcha is the action name.
RedisCacheKeyPrefix & GoogleReCaptchaValidationMessage are the rendering parameters, i.e the exact field names of the rendering parameter template.
I'm assigning the default values here.
In the code, reading the values:
string prefix= RenderingContext.Current.Rendering.Parameters["RedisCacheKeyPrefix"]
string message= RenderingContext.Current.Rendering.Parameters["GoogleReCaptchaValidationMessage"]
But they are always null.
What is the correct way to pass the rendering parameters in this case.
controller
add a comment |
There is need to load a controller rendering from the Razor view.
I'm doing it this way:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
Here Captcha is the controller name, GoogleReCaptcha is the action name.
RedisCacheKeyPrefix & GoogleReCaptchaValidationMessage are the rendering parameters, i.e the exact field names of the rendering parameter template.
I'm assigning the default values here.
In the code, reading the values:
string prefix= RenderingContext.Current.Rendering.Parameters["RedisCacheKeyPrefix"]
string message= RenderingContext.Current.Rendering.Parameters["GoogleReCaptchaValidationMessage"]
But they are always null.
What is the correct way to pass the rendering parameters in this case.
controller
add a comment |
There is need to load a controller rendering from the Razor view.
I'm doing it this way:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
Here Captcha is the controller name, GoogleReCaptcha is the action name.
RedisCacheKeyPrefix & GoogleReCaptchaValidationMessage are the rendering parameters, i.e the exact field names of the rendering parameter template.
I'm assigning the default values here.
In the code, reading the values:
string prefix= RenderingContext.Current.Rendering.Parameters["RedisCacheKeyPrefix"]
string message= RenderingContext.Current.Rendering.Parameters["GoogleReCaptchaValidationMessage"]
But they are always null.
What is the correct way to pass the rendering parameters in this case.
controller
There is need to load a controller rendering from the Razor view.
I'm doing it this way:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
Here Captcha is the controller name, GoogleReCaptcha is the action name.
RedisCacheKeyPrefix & GoogleReCaptchaValidationMessage are the rendering parameters, i.e the exact field names of the rendering parameter template.
I'm assigning the default values here.
In the code, reading the values:
string prefix= RenderingContext.Current.Rendering.Parameters["RedisCacheKeyPrefix"]
string message= RenderingContext.Current.Rendering.Parameters["GoogleReCaptchaValidationMessage"]
But they are always null.
What is the correct way to pass the rendering parameters in this case.
controller
controller
asked 8 hours ago
QwertyQwerty
9491 gold badge9 silver badges29 bronze badges
9491 gold badge9 silver badges29 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The naming of the 3rd parameter of @Html.Sitecore().ControllerRendering method is a bit unfortunate. It's called parameters, while in my opinion it should be called properties.
The reason for that is one can access what is passed via this parameter using
RenderingContext.Current.Rendering.Properties[...]
So in your example:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
can be accessed using
string prefix = RenderingContext.Current.Rendering.Properties["RedisCacheKeyPrefix"]
string message = RenderingContext.Current.Rendering.Properties["GoogleReCaptchaValidationMessage"]
add a comment |
I suggest that you create a setting item somewhere in Sitecore that contain's the two properties / fields, and then set the setting item as a DataSource:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new
DataSource = "sitecore-id-of-setting-item"
)
Something like this.
Then your content is editable and you can request the DataSource item (with the two fields) in your controller as usual.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "664"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f19742%2fhow-to-pass-rendering-parameters-for-a-static-controller-rendering%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The naming of the 3rd parameter of @Html.Sitecore().ControllerRendering method is a bit unfortunate. It's called parameters, while in my opinion it should be called properties.
The reason for that is one can access what is passed via this parameter using
RenderingContext.Current.Rendering.Properties[...]
So in your example:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
can be accessed using
string prefix = RenderingContext.Current.Rendering.Properties["RedisCacheKeyPrefix"]
string message = RenderingContext.Current.Rendering.Properties["GoogleReCaptchaValidationMessage"]
add a comment |
The naming of the 3rd parameter of @Html.Sitecore().ControllerRendering method is a bit unfortunate. It's called parameters, while in my opinion it should be called properties.
The reason for that is one can access what is passed via this parameter using
RenderingContext.Current.Rendering.Properties[...]
So in your example:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
can be accessed using
string prefix = RenderingContext.Current.Rendering.Properties["RedisCacheKeyPrefix"]
string message = RenderingContext.Current.Rendering.Properties["GoogleReCaptchaValidationMessage"]
add a comment |
The naming of the 3rd parameter of @Html.Sitecore().ControllerRendering method is a bit unfortunate. It's called parameters, while in my opinion it should be called properties.
The reason for that is one can access what is passed via this parameter using
RenderingContext.Current.Rendering.Properties[...]
So in your example:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
can be accessed using
string prefix = RenderingContext.Current.Rendering.Properties["RedisCacheKeyPrefix"]
string message = RenderingContext.Current.Rendering.Properties["GoogleReCaptchaValidationMessage"]
The naming of the 3rd parameter of @Html.Sitecore().ControllerRendering method is a bit unfortunate. It's called parameters, while in my opinion it should be called properties.
The reason for that is one can access what is passed via this parameter using
RenderingContext.Current.Rendering.Properties[...]
So in your example:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new RedisCacheKeyPrefix = "scans_", GoogleReCaptchaValidationMessage = "Please fill up the captcha" )
can be accessed using
string prefix = RenderingContext.Current.Rendering.Properties["RedisCacheKeyPrefix"]
string message = RenderingContext.Current.Rendering.Properties["GoogleReCaptchaValidationMessage"]
answered 7 hours ago
Marek MusielakMarek Musielak
13.2k1 gold badge14 silver badges38 bronze badges
13.2k1 gold badge14 silver badges38 bronze badges
add a comment |
add a comment |
I suggest that you create a setting item somewhere in Sitecore that contain's the two properties / fields, and then set the setting item as a DataSource:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new
DataSource = "sitecore-id-of-setting-item"
)
Something like this.
Then your content is editable and you can request the DataSource item (with the two fields) in your controller as usual.
add a comment |
I suggest that you create a setting item somewhere in Sitecore that contain's the two properties / fields, and then set the setting item as a DataSource:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new
DataSource = "sitecore-id-of-setting-item"
)
Something like this.
Then your content is editable and you can request the DataSource item (with the two fields) in your controller as usual.
add a comment |
I suggest that you create a setting item somewhere in Sitecore that contain's the two properties / fields, and then set the setting item as a DataSource:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new
DataSource = "sitecore-id-of-setting-item"
)
Something like this.
Then your content is editable and you can request the DataSource item (with the two fields) in your controller as usual.
I suggest that you create a setting item somewhere in Sitecore that contain's the two properties / fields, and then set the setting item as a DataSource:
@Html.Sitecore().ControllerRendering("Captcha", "GoogleReCaptcha", new
DataSource = "sitecore-id-of-setting-item"
)
Something like this.
Then your content is editable and you can request the DataSource item (with the two fields) in your controller as usual.
answered 7 hours ago
mp1990mp1990
1116 bronze badges
1116 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Sitecore Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f19742%2fhow-to-pass-rendering-parameters-for-a-static-controller-rendering%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown