We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [mvc]

For questions relating to ASP.NET MVC implementations. The ASP.NET MVC is a web application framework developed by Microsoft, which implements the model–view–controller pattern.

Filter by
Sorted by
Tagged with
0
votes
1answer
45 views

Calling async method inside action index() method

I want to call async method inside the ActionResult. This is how my code looks like public HomeController : GlassController { public override Task<ActionResult> Index() { /...
0
votes
1answer
24 views

Rendering Model differences in Sitecore 8.2 vs 9.1

I am upgrading a solution from Sitecore 8.2 to Sitecore 9.1. In Sitecore 8.2, we have a rendering definition item within Sitecore that only has a View file defined. The rendering definition does not ...
0
votes
0answers
44 views

Rendering causing error in experience editor only on some pages?

I have a rendering that displays fine on our CD servers, and in Experience Editor on some pages, but not on one page, where it's throwing an error. When I check the logs I see the following error: ...
2
votes
1answer
178 views

Programmatically add log information in all renderings (controller, view) HTML

Is there an option to write some logging information, like rendering name and data-source location, in every view programmatically, without go and modified in all views?
0
votes
2answers
36 views

Domain level cookie in Sitecore

I need to set main domain(abc.dis.com) cookie in my sub domain(xyz.dis.com) in sitecore,please suggest. Please find the below code snippet,but it's not working. Thanks in Advance
4
votes
1answer
275 views

Is it possible to combine Sitecore 9.1+DotNet+React Js

I have a requirement in my project. It is an existing project which is developed in Dotnet MVC + Sitecore 9.1, so some part of the page in that project needs to be implemented in react js, for example,...
0
votes
1answer
26 views

Retrieving items from a multiselect Rendering Parameter

I'm trying to retrieve items via a multiselect rendering parameter. It parses the rendering parameter correctly but even though it doesn't throw an error when adding a new item to the model, when it ...
0
votes
1answer
142 views

Any Best way to call the MVC action method from Hyperlink

Currently, we are having a hyperlink tag and the MVC action method is called directly from hyperlink as <a href="/api/sitecore/{controller Name}/{action Name}"> Hyperlink Text While hovering ...
0
votes
2answers
447 views

Retrieving url from general link field in rendering parameter

I'm trying to grab the id and/or url attribute of a general link rendering parameter in the view, but I can't seem to make it work. I can't cast it to a Linkfield (it says it can't cast a string to a ...
3
votes
1answer
120 views

retrieving the url from a link field in a view

I'm trying to retrieve just the url attribute of a link field for an item in a view. The view is just using the item as it's model so just retrieving the link field value, which is producing the ...
-1
votes
2answers
100 views

Issue sending Base64 encoded image in JSON to Sitecore MVC controller method

I wonder if someone could help or point me in the right direction as a Sitecore novice. I have a Sitecore MVC controller wired up to accept a JSON request. Within this request can be a Base64 encoded ...
1
vote
2answers
189 views

How to get Rendering from RenderingReference

We are using Sitecore 9.1 MVC. It is possible to get all rendering references for a given item by using: item.Visualization.GetRenderings(Sitecore.Context.Device, true) However, this will give me ...
0
votes
1answer
111 views

How do you end the current request when performing a response redirect in a RequestBeginProcessor

I have args.AbortPipeline(); HttpContext.Current.Response.Redirect(result.Url + $"?q={searchTerm}", true); but the request continues to the controller
0
votes
1answer
86 views

Create multiple Views under one folder and have the different controller resolve the respective Views

Implementation: I am creating my custom SXA components for Header, Footer and Breadcrumb I have a project "Navigation". Under Navigation I have created three controllers Header, Breadcrumb, Footer. ...
1
vote
1answer
135 views

How do you register an MVC Area with Sitecore 9?

I have a pre-existing Sitecore 9 instance that houses an existing website. I have created a new solution, with a new web project, and am attempting to install this project into the existing Sitecore ...
0
votes
1answer
185 views

Can I render a link with title and aria-label attributes using BeginField?

I'm using SXA 1.8 with Sitecore 9.1 For a cloned rendering - in my cshtml I need to conditionally wrap a list item in a link. I have got the link part working, but I can't seem to add title and aria-...
1
vote
1answer
210 views

Is there a way to use the Sitecore MVC Field helpers and render a General Link with stuff appended to the query string?

I have an item with a General Link field named "MyLinkField". In my view I have the following: @Sitecore.Html().Field("MyLinkField") That works great to output the link. Now I have added a ...
0
votes
2answers
270 views

Redirect URL A to URL B

I want to redirect one URL to the another. Suppose, I have 2 URLs www.abc.com/home/gateway [Item for /gateway is not created in sitecore] www.xyz.com/newgateway.php [This is not a Sitecore Webpage] ...
1
vote
2answers
274 views

Checking if a general link is empty within a partial view

I can display a link from a field but I only want to display the link if it's been filled out by the user. I tried surrounding by a conditional statement and checking for the field being null, but ...
0
votes
1answer
775 views

Error Rendering View

I am trying to preview a page from Sitecore Rock, from VS but I get this error. I have a Layouts, and I have putted that layouts in _Standard Values of that page. I don't know where is the problem now ...
0
votes
1answer
112 views

Sitecore SXA action call a controller action

how to create a button in Sitecore SXA which would call a controller action or a rest Api ? would it be through javascript or is there an ootb feature in SXA , where i could get the user and item ...
1
vote
2answers
150 views

Is creating a Model under /sitecore/layout/Models a best pratice?

I was wondering if there was something more modern than having to create a Model item under /sitecore/layout/Models for every view rendering I have. If I'm informing the view the namespace and type I ...
2
votes
2answers
438 views

How to retrieve image url in MVC view from model

I am new to Sitecore. I am trying to create a small demo which will display all the products with its image and description. But i am getting error in my view also i am not able to display anything. ...
1
vote
2answers
307 views

Response.Redirect in Mvc.requestbegin processor does not end response

Im doing below in mvc.requestbegin processor if (!IdentityChecker.IsUserIdentityValid(args.RequestContext.HttpContext.Request.RequestContext.HttpContext.Request) && !args.RequestContext....
1
vote
1answer
211 views

How can I integrate/embed MVC app into the Sitecore desktop?

I've got a third party MVC app that I would like to integrate into the Sitecore 7.2 desktop so that users logging into Sitecore can use it. I've seen the answers for using compiled DLLs as renderings ...
0
votes
2answers
2k views

How do I access Sitecore.Context.Item in normal MVC Controller

I have a normal MVC Controller (not a Sitecore Rendering) which I am calling in an AJAX request (from a Sitecore page). I need the current Sitecore item there. How can I access it there?
1
vote
2answers
354 views

Accessing IMvcContext/ISitecoreService in a view rendering

This is using Sitecore 9.0.2 and Glass 5.1.10. I'm trying to figure out the best way to access the IMvcContext (or ISitecoreService) in a view rendering. Using controller rendering is very ...
2
votes
1answer
209 views

Requested document not found when using MVC routes

I am getting 404s (requested document not found) when I try to use a custom route I created per the guide here: https://kb.sitecore.net/articles/700677. My patch config is showing up in showconfig, ...
2
votes
1answer
951 views

Get MultilistField selected items

I am working on a view rendering and trying to get a list of selected items from a multilist field. I don't know if it matters, but the list field I am trying to get the selected items from is a ...
5
votes
1answer
443 views

How can I append HTML within and before the text of a rendered Link Field?

I have a General Link field in Sitecore that I would like to append some HTML to. I know that I can create a custom extension method and put what I want after the link's text by doing the following: ...
3
votes
0answers
345 views

Image and link fields rendering as raw values

I'm using Sitecore 8.2 and attempting to render Image and General Link fields as recommended in this post: @model Company.Feature.Foo.Models.FooBarViewModel ... @Html.Sitecore().Field("{123e4567-e89b-...
1
vote
1answer
227 views

How to render a web form Sublayout in MVC layout?

I am trying to render an Ascx page from an MVC View Rendering in Sitecore. For example, in old Web Forms / Ascx to put placeholders you'd use <sc:Placeholder runat="server" key="placeholder-key" /&...
0
votes
1answer
76 views

Third Party custom controls for Sitecore

Does anyone know of a suite of third-party custom controls that are available for purchase for Sitecore? Or are you just using the standard VS third-party tools? We are going to start rewriting our ...
0
votes
1answer
179 views

Sitecore 7.2 using droplink

I will start out by saying I am a bit of a noob when it comes to C# and Sitecore, but I am getting better. I am trying to update our code to use a droplink control for an event item (we'll call it ...
2
votes
4answers
317 views

Sitecore custom log file is empty

Please help me what am missing in writing log for the exception. Always am getting an empty file Logger in Sitecore.Config <?xml version="1.0" encoding="UTF-8"?> <log4net> <...
6
votes
1answer
308 views

Sitecore 8.2 MVC site setup and Issues

I am creating a Sitecore 8.2 MVC test website and I am getting couple of errors and client form validation Issue. Get methods are working fine but post method is not working. I have exact same test ...
6
votes
1answer
58 views

Is WFFM with MVC supported in Sitecore 7.1?

We are on Sitecore 7.1 (rev. 140324) and need to use WFFM with MVC. Therefore I would like to check if Sitecore 7.1 (rev. 140324) supports WFFM with MVC.
1
vote
1answer
272 views

The type or namespace 'code' could not be found

In my Helix based solution, every time I publish a change to a feature project and load the site I get this error below. The error goes away when I publish the website project in the project layer. ...
5
votes
2answers
227 views

Is it possible to have several campaign personalisation for the same component?

I need to develop a specific feature that allows me to personalize a component "banner" of a page based on campaigns.(so basically this is based on querystrings in url) Here is my configuration: For ...
8
votes
1answer
318 views

Upgrade path from Integrated Dynamic Placeholders to Sitecore 9 Dynamic Placeholders (OOTB)

Does anyone have a SPE script that could be used to upgrade the rendering parameters of existing content to the new dynamic placeholder style required for Sitecore 9 Dynamic placeholders? We used to ...
1
vote
1answer
757 views

Rendering a Sitecore field in MVC with an enclosing tag and class

We effectively have an item with three fields. Text to display in a heading. Droplink with the type of heading to display the text in (h1, h2, ...). Droplink with the heading style that points to the ...
3
votes
1answer
448 views

MVC rendering not being rendered in normal mode

I have a rendering that is on an item, and all its dependencies and templates are published (this has been verified). The rendering itself is inside a dynamic placeholder. It shows up fine in edit ...
0
votes
1answer
245 views

Is it possible to display field name in View(cshtml) using glass mapper

I am trying to display field name using Glass Mapper in view rendering in following format: FieldName - FieldValue FieldName - FieldValue Ex: Country - USA City - New York I ...
5
votes
1answer
277 views

Force controller rendering in head of page to render after other renderings

I know that MVC and by definition Sitecore MVC renders components from top to bottom order, but is there any way to force (hack) a controller rendering (which is used in the head of the page) to be ...
6
votes
1answer
271 views

Pre-populate form fields in WFFM

I have a requirement to pre-populate fields from an external source. Is there a way to hook into a pipeline to achieve this? I'm thinking something similar to how Sitecore can populate the fields by ...
0
votes
2answers
195 views

Powershell Script error

I am trying to import csv file to content data via power shell script.am getting following error message New-UsingBlock : Item '/sitecore/content/Web3/Content Shared Folder/Property Page' is ...
5
votes
2answers
1k views

How do you programmatically get the HTML from a Sitecore item, including all its renderings?

I'm trying to programmatically get the HTML from an item, including its presentation details (i.e. placeholder items inserted via Experience Editor). I'm using the top solution from this post but it ...
3
votes
0answers
350 views

Generating JSON-LD structured data for SEO

We are working on an MVC web site where we are following the principles of atomic design, with heavy use of placeholders (including dynamic) and very granular renderings. This site's pages are heavily ...
0
votes
1answer
506 views

Sitecore Edit Frame issue

I am having issues when passing Guid as the data source for edit Frame. When I populate the Guid directly it works fine but while binding it from model am getting an error message Code: @using ...
0
votes
1answer
836 views

Programatically render nested renderings/placeholders from an item [duplicate]

I am working on programatically rendering an item to html in code. I found this question https://sitecore.stackexchange.com/a/6256/1133 which almost serves the purpose of my request, except it isn't ...