Skip to main content

I have a view that works fine to display rendering parametersrendering parameters for a title and body of a widget, however, I've added a checkbox field to the rendering items for that template and when I try to use it in the view to check it seems to give me a null reference exception. I've

I've tried checking to see if RenderingContext.Current.Rendering.Parameters["Expandable"]RenderingContext.Current.Rendering.Parameters["Expandable"] is equal to "0" or "false" but this fails regardless of whether the checkbox is checked or not and when I try to display RenderingContext.Current.Rendering.Parameters["Expandable"]RenderingContext.Current.Rendering.Parameters["Expandable"] as part of the body of the widget it throws a null referencenull reference exception. What

What am I doing wrong? How

How do I retrieve the value of such a rendering parameterrendering parameter within the view??

I have a view that works fine to display rendering parameters for a title and body of a widget, however, I've added a checkbox field to the rendering items for that template and when I try to use it in the view to check it seems to give me a null reference exception. I've tried checking to see if RenderingContext.Current.Rendering.Parameters["Expandable"] is equal to "0" or "false" but this fails regardless of whether the checkbox is checked or not and when I try to display RenderingContext.Current.Rendering.Parameters["Expandable"] as part of the body of the widget it throws a null reference exception. What am I doing wrong? How do I retrieve the value of such a rendering parameter within the view??

I have a view that works fine to display rendering parameters for a title and body of a widget, however, I've added a checkbox field to the rendering items for that template and when I try to use it in the view to check it seems to give me a null reference exception.

I've tried checking to see if RenderingContext.Current.Rendering.Parameters["Expandable"] is equal to "0" or "false" but this fails regardless of whether the checkbox is checked or not and when I try to display RenderingContext.Current.Rendering.Parameters["Expandable"] as part of the body of the widget it throws a null reference exception.

What am I doing wrong?

How do I retrieve the value of such a rendering parameter within the view?

Source Link
Levi Wallach
  • 1.1k
  • 11
  • 26

Checking for a checkbox rendering parameter value in view

I have a view that works fine to display rendering parameters for a title and body of a widget, however, I've added a checkbox field to the rendering items for that template and when I try to use it in the view to check it seems to give me a null reference exception. I've tried checking to see if RenderingContext.Current.Rendering.Parameters["Expandable"] is equal to "0" or "false" but this fails regardless of whether the checkbox is checked or not and when I try to display RenderingContext.Current.Rendering.Parameters["Expandable"] as part of the body of the widget it throws a null reference exception. What am I doing wrong? How do I retrieve the value of such a rendering parameter within the view??