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;








4















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.










share|improve this question




























    4















    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.










    share|improve this question
























      4












      4








      4








      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 8 hours ago









      QwertyQwerty

      9491 gold badge9 silver badges29 bronze badges




      9491 gold badge9 silver badges29 bronze badges




















          2 Answers
          2






          active

          oldest

          votes


















          3














          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"]





          share|improve this answer






























            -1














            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.






            share|improve this answer

























              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
              );



              );













              draft saved

              draft discarded


















              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









              3














              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"]





              share|improve this answer



























                3














                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"]





                share|improve this answer

























                  3












                  3








                  3







                  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"]





                  share|improve this answer













                  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"]






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 7 hours ago









                  Marek MusielakMarek Musielak

                  13.2k1 gold badge14 silver badges38 bronze badges




                  13.2k1 gold badge14 silver badges38 bronze badges























                      -1














                      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.






                      share|improve this answer



























                        -1














                        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.






                        share|improve this answer

























                          -1












                          -1








                          -1







                          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.






                          share|improve this answer













                          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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 7 hours ago









                          mp1990mp1990

                          1116 bronze badges




                          1116 bronze badges



























                              draft saved

                              draft discarded
















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                              Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                              In Tikz, how to set a node's label alignment to the left?Rotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?TikZ/ERD: node (=Entity) label on the insideLine up nested tikz enviroments or how to get rid of themVertically align a tikzpicture and forestDrawing tikz line in the margin for multiple pagesLongtable, contained tikz, padding, custom columns, and an alignment issueTikZ: define arrow starting position based on style and format node labelAlign node name in Tikz