Questions tagged [viewresult]
31 questions
0
votes
2 answers
How to get the content of a ViewResult in MVC?
I have a view that is rendered with ContentType of "application/msword". For users this appears as download file. Now, I would like to save this document server side. How could get I access the rendered document server side ?

Zoliqa
- 1,015
- 2
- 15
- 36
0
votes
1 answer
HTTP Requset names are not coming in listener
When I am running threadgroup for 5 loops in jmeter, the HTTP Request name are not coming after the first loop in View Result tree.Please guide me.
0
votes
0 answers
C# Inject Javascript into View with JsonResult
I have a Controller Action which returns a JsonResult instead of a View. Depending on whether or not the method completed successfully, I need to add and execute a Javascript. I've added an OnActionExecuted ActionFilter to the method to generate and…

M. Chris
- 161
- 2
- 14
0
votes
3 answers
MVC Core ajax and return result is a view
MVC Core, NET 5, not razor pages.
On a view I have three select components (bootstrap-select). I populate them via ViewModel.
"Get request -> Controller -> return View(viewModel);"
What I want...
When I changed value in any select component I do a…

aik
- 97
- 2
- 7
0
votes
2 answers
JMeter View results tree listener displaying duplicate https requests
View result listener displaying duplicate https requests, 1 request is without response and 1 request is with having response. I need only 1 request, How can i fix it?
enter image description here
enter image description here
0
votes
1 answer
Convert JsonResult to ViewResult in Filter with ASP.NET Core
My task is to make sure that a controller can return a Json-like response or a View based on who calls the corresponding API.
To do that, I changed the returns of each controller I made so that they give a JsonResult and I created a class that…

Valerio Colonnese
- 129
- 3
- 10
0
votes
1 answer
Initializing ViewData property inside ViewResult object
When I access ViewData inside a method in the controller, I am able to assign the value in the form of dictionary ie.
ViewData["message"]="this is a custom message";
but I got into a scenario where I was trying to handle the Exception in MVC, here…

Lijin Durairaj
- 4,910
- 15
- 52
- 85
0
votes
0 answers
How to pass dropdownbox select value to a controller in asp.net mvc using Ajax?
I have the following DropDownListFor generated by razor:
@Html.DropDownListFor(m => m.SelectedSize, Model.AvailableSizes, "Select Size", new { @class = "form-control input-sm", @id ="availablesize" })
I want to pass the selected value of…

Coding Freak
- 418
- 1
- 8
- 27
0
votes
1 answer
ViewResult and lookup directories
new ViewResult() { ViewName = "Error_403" };
in this case .net looks through current controller view directory (~/Views/Home/) and in shared (~/Views/Shared/)
Is there any way to point to specific directory right here ViewName =…

zerkms
- 249,484
- 69
- 436
- 539
0
votes
3 answers
How do I determine which View is used when calling View(Object model)
First, some context:
Language - C#
Platform - .Net Framework 4.5
Project type - ASP.Net MVC 4
I am trying to determine which View in an MVC project is handling an explicit call to the following method. The MSDN docs for the method are here: …

bopapa_1979
- 8,949
- 10
- 51
- 76
0
votes
1 answer
Extending PartialViewResult, Model isn't validated?
I've got a class which extends PartialViewResult and in this class I'm setting the Response.StatusCode and the Model via ViewData.
My model and statuscode are getting set as I'd expect, but my model isn't validated. Are their additional steps needed…

dougajmcdonald
- 19,231
- 12
- 56
- 89
0
votes
1 answer
MVC Filter ViewResult
I have some filters set up on an MVC C# framework. From here I am try to render an error page. The error page renders correctly, but I want to pass data from the HandleUnautorizedRequest (that depends on which filter you fail) so far I have this. …

nicmoon
- 136
- 1
- 7
0
votes
1 answer
How can I return two views from an action?
How can I return two views from an action?
I tried as below but I got an error.
public ActionResult Page()
{
//LINQ x expressions
//LINQ y expressions
if (Request.QueryString["type"] == "x")
{
return View(linqExpX.ToList());
…

user2282567
- 781
- 1
- 7
- 14
0
votes
1 answer
Unit testing controller method property
I'm working through Pro ASP.NET MVC 4 by Apress and am trying to understand the syntax used in unit testing a particular controller method.
Given a controller method for a class SomeController:
public ViewResult List(int someInt) {
ViewModel…

CBean
- 5
- 1
0
votes
1 answer
How to change the content of ViewResult
bool isChecked = false;
In MVC 4, The above code will be generate as
But in MVC 3,Need to write like this:
bool isChecked = false;
@if(isChecked)
{
…

LooseLive
- 69
- 1
- 8