Skip to main content
added 171 characters in body
Source Link
Shaurya
  • 457
  • 2
  • 16

@Edited after Mark's answer.

I have a ascx control where I have defined some variables.

<%
var showFilters = RenderingParameters.ShowFilters;
var minimizeCardHeight = RenderingParameters.MinimizeCardHeight;
var numberOfProfiles = 0;
%>
<sc:EditFrame ID="editContributors" runat="server" Title="Contributors Area" Buttons="/sitecore/content/Applications/WebEdit/Edit Frame Buttons/Test Button">
<div class='test'><%=minimizeCardHeightclass='test'>
<% %><if(minimizeCardHeight) { %> 
<div class="divider"></div>
<% } %>
</div>
</sc:EditFrame>

Now, in visual studio there is no error shown for any variables but when I publish the code and run the page in Experience Editor, a compilation error is thrown

CS0103: The name 'minimizeCardHeight' does not exist in the current context

Please let me know what I am doing wrong here.

I have a ascx control where I have defined some variables.

<%
var showFilters = RenderingParameters.ShowFilters;
var minimizeCardHeight = RenderingParameters.MinimizeCardHeight;
var numberOfProfiles = 0;
%>
<sc:EditFrame ID="editContributors" runat="server" Title="Contributors Area" Buttons="/sitecore/content/Applications/WebEdit/Edit Frame Buttons/Test Button">
<div class='test'><%=minimizeCardHeight %></div>
</sc:EditFrame>

Now, in visual studio there is no error shown for any variables but when I publish the code and run the page in Experience Editor, a compilation error is thrown

CS0103: The name 'minimizeCardHeight' does not exist in the current context

Please let me know what I am doing wrong here.

@Edited after Mark's answer.

I have a ascx control where I have defined some variables.

<%
var showFilters = RenderingParameters.ShowFilters;
var minimizeCardHeight = RenderingParameters.MinimizeCardHeight;
var numberOfProfiles = 0;
%>
<sc:EditFrame ID="editContributors" runat="server" Title="Contributors Area" Buttons="/sitecore/content/Applications/WebEdit/Edit Frame Buttons/Test Button">
<div class='test'>
<% if(minimizeCardHeight) { %> 
<div class="divider"></div>
<% } %>
</div>
</sc:EditFrame>

Now, in visual studio there is no error shown for any variables but when I publish the code and run the page in Experience Editor, a compilation error is thrown

CS0103: The name 'minimizeCardHeight' does not exist in the current context

Please let me know what I am doing wrong here.

Source Link
Shaurya
  • 457
  • 2
  • 16

Not able to use local variables in Sitecore Edit Frames

I have a ascx control where I have defined some variables.

<%
var showFilters = RenderingParameters.ShowFilters;
var minimizeCardHeight = RenderingParameters.MinimizeCardHeight;
var numberOfProfiles = 0;
%>
<sc:EditFrame ID="editContributors" runat="server" Title="Contributors Area" Buttons="/sitecore/content/Applications/WebEdit/Edit Frame Buttons/Test Button">
<div class='test'><%=minimizeCardHeight %></div>
</sc:EditFrame>

Now, in visual studio there is no error shown for any variables but when I publish the code and run the page in Experience Editor, a compilation error is thrown

CS0103: The name 'minimizeCardHeight' does not exist in the current context

Please let me know what I am doing wrong here.