How to get the value from this type of model in the code. I have a simple carousel and I can get values easily from fields now I just want to get the Rendering Parameters for this specific rendering. Is that possible to do if the model is VariantListsRenderingModel?

This is what I mean by this:`

enter image description here

  • Did you try getting these rendering parameters with traditional approach? Like - logicalfeed.com/posts/114/… Commented Mar 10, 2022 at 12:50
  • I did not tried this but hopefully it will work. I did not tried it beacuse it is SXA Model so do not know if it will work
    – Samke11
    Commented Mar 10, 2022 at 13:03

1 Answer 1


You can get the rendering parameters value in the view as well as in the controller.

Try to use the below code in the view

    string name=""
    var renderingContext = Sitecore.Mvc.Presentation.RenderingContext.CurrentOrNull;
    if (renderingContext != null)
        var parms = renderingContext.Rendering.Parameters;
        name= parms["name of the field here"];

In the controller, you can use the below code :

 var addtionalCssParameter = RenderingContext.Current.Rendering.Parameters["name of the field"];

Both approach will work in SXA. If you will get an issue in SXA then you can try this code in the view.

    string name= Convert.ToString(Model.Rendering.Parameters["name of the field"]);
  • Thank you for the answer! @Ashish
    – Samke11
    Commented Mar 10, 2022 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.