Skip to main content
Share Your Experience: Take the 2024 Developer Survey
26 votes
Accepted

Editable Sitecore fields with Glass

This should give you what you want: @using (Html.Glass().BeginRenderLink(Model, m => m.MyLinkField, null, true) { @Html.Glass().RenderImage(Model, m => m.MyImageField, null, true) }
Corey Smith's user avatar
  • 2,718
24 votes
Accepted

C# MVC razor view - HtmlHelper does not contain a definition for 'Sitecore'

There's a web.config that has Sitecore references that should exist in the /Views that is probably not right. This can be a common occurrence if using a new .NET MVC Project in Visual Studio and it ...
Pete Navarra's user avatar
  • 14.7k
12 votes
Accepted

Glass BeginRenderLink not showing text node

The fact that BeginRenderLink does not render link text inside the <a> tag is not bug. As Glass Mapper documentation says, BeginRenderLink is not really for displaying the default link text. ...
Marek Musielak's user avatar
  • 23.8k
6 votes

Is there a way to supress rendering width and height attribs using Fortis Image.Render?

You can't do that out of the box with Fortis because under the hood it is just using the standard Sitecore Field Renderer. This is what is adding the width and height attributes. There is a nice ...
Richard Seal's user avatar
  • 20.5k
6 votes
Accepted

How to Render @Html.Sitecore().Field using custom Model Item in Sitecore MVC

@Html.Sitecore().Field only works with real items and it sounds like Model.ArticleItem is not a real Sitecore Item. What you want to do is render the Sitecore field as HTML in your model and render ...
Chris Auer's user avatar
  • 13.1k
6 votes
Accepted

Sitecore instance is very slow after deployment in Azure Paas

With regards to the initial very large time, what you're most likely hitting is that Sitecore can max out the Azure SQL on startup to fill the prefetch cache - see Sitecore Knowledge Base Article ...
Matthew FitzGerald-Chamberlain's user avatar
4 votes
Accepted

Custom View Engine for Razor View Helix-type default paths

Yes, you can create your custom View Engine to resolve relative paths based on the assembly name. So, following this guide: https://weblogs.asp.net/imranbaloch/view-engine-with-dynamic-view-location ...
Andrey Bobrov's user avatar
3 votes
Accepted

Sitecore Helper to render SXA Component inside cshtml

You have 2 main options: Use a placeholder In your razor view, just add a placeholder, then in the Experience Editor, your marketers/editors can add the Social Media Share module to that. Pros - ...
Richard Seal's user avatar
  • 20.5k
3 votes

Put Sitecore component on page based on QueryString

I think your title is a little different than what you want to really achieve. But you could build a Controller Rendering, that looks at the current pages Querystring, to get it's Id, and use that to ...
Dylan Young's user avatar
  • 4,314
2 votes
Accepted

Put Sitecore component on page based on QueryString

You may need to statically add your rendering inside the container rendering, something like this would work inside the container rendering @{ var featBlogPost = Request.QueryString["featpost"]; ...
Ahmed Okour's user avatar
  • 2,124
2 votes

How to Render @Html.Sitecore().Field using custom Model Item in Sitecore MVC

In your controller (or service), you could also add the Sitecore.Items.Item on the view model that you send to your view and then use that item to render the content and Experience Editor ...
Dan Sinclair's user avatar
  • 5,395
2 votes
Accepted

How to cache bust CSS and JS assets in Sitecore Helix

There are many methods, but since we build Helix projects with gulp one option is to leverage gulp to perform this action automatically. At the top of your your gulpfile.js, require these modules: var ...
Marcel Gruber's user avatar
1 vote

Search Results caching

Your "if" statement mentions Creative Exchange: if (WebUtil.GetQueryString(Sitecore.XA.Feature.Search.Constants.CreativeExchangeExport) != "true") This tells me that the else part will be executed ...
Gatogordo's user avatar
  • 20.1k
1 vote
Accepted

Item preview fails with "Section or group name 'system.web.webPages.razor' is already defined"

Coveo for Sitecore 4.1 came with Web.configs that referenced System.Web.WebPages.Razor V2.0.0. My project uses 3.0.0. I had to update the version in the following files to 3.0.0: Views/Coveo/Web....
Paul's user avatar
  • 555
1 vote

C# MVC razor view - HtmlHelper does not contain a definition for 'Sitecore'

I also encountered the same thing. I grabbed the web.config from the habitat demo solution, one of the web.config from the views there and it works fine. Here's the full web.config. <?xml ...
Marvin Glenn Lacuna's user avatar
1 vote

C# MVC razor view - HtmlHelper does not contain a definition for 'Sitecore'

I think you are missing Sitecore from your Views web.config. You web.config in the /views folder should look like this <system.web.webPages.razor> <host factoryType="System.Web.Mvc....
Chris Auer's user avatar
  • 13.1k

Only top scored, non community-wiki answers of a minimum length are eligible