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.