Questions tagged [routevalues]
50 questions
0
votes
2 answers
In MVC, why does the routeValues property in RedirectToAction() not accept my class as argument?
So here's the deal, i want to be able to export any Enumerable of items to excel:
Here's an ActionMethod in some Area of my app that constructs an "ExportToExcel" model, then Redirects it to an Action Method in another controller and another are…

seed_87
- 179
- 1
- 1
- 11
0
votes
1 answer
Html.BeginForm Route Values including Form Radio Button result
I have asked a couple of questions over the last couple of days, that probably did not get answered because it might have been to broad. After some research, I may have narrowed it down a little bit.
I am wondering if there is a way that I can use…

SoftwareSavant
- 9,467
- 27
- 121
- 195
0
votes
1 answer
ASP.NET MVC AnchorLink not using route values?
I'm using AnchorLink on a very simple site with just two routes defined, one standard route and another area route for admin/{controller}/{action}/{id}. I'm at a URL like:
/admin/release/push/255
In that view I'm using:
@Html.AnchorLink("Confirm",…

jdh
- 1
0
votes
2 answers
RouteValues.TryGetValue gives "Local variable 'X' might not be initialized before accessing" error even if the result is true?
if (!this._contextAccessor.HttpContext?.Request.RouteValues.TryGetValue("requiredId", out
var idRouteParam) ?? true)
return Task.CompletedTask;
var id = (int)idRouteParam;
I figured by the time it got to the cast everything would work…

Mufasatheking
- 387
- 2
- 6
- 16
0
votes
1 answer
How to get the current url with route values?
I'm trying to retrieve the current request url with routes values, in order to have a return url with all needed values when reaching my controllers.
I tried HttpContext.Request.Path and HttpContext.Request.GetDisplayUrl() but it returns something…

j0w
- 505
- 2
- 12
- 32
0
votes
1 answer
Customize ASP.NET MVC RouteValues serialization into GET parameters
Good day!
I pass DateTime value as route parameter and it became GET parameter in form like this:
http://example.com/?DateFrom=01%2F01%2F2011%2000%3A00%3A00&DateTo=01%2F31%2F2011%2000%3A00%3A00
For readability: this is an URL encoded…

artvolk
- 9,448
- 11
- 56
- 85
0
votes
1 answer
Is the RouteValueDictionary class's keys case-insensitive?
The documentation states that it "Represents a case-insensitive collection of key/value pairs that you use in various places in the routing framework, such as when you define the default values for a route or when you generate a URL that is based on…

Triynko
- 18,766
- 21
- 107
- 173
0
votes
1 answer
can we place some data inside the circle drawn on the google map using google map api
I am using the sample from google map API to draw the circle and wanted to place the population value inside the circle for the plots can we do this in google map API …

DhanaLaxshmi
- 424
- 1
- 11
- 24
0
votes
1 answer
How do I pass info to route values so I can redirect back after I login Asp.Net MVC
Here is my actionlink to my login page with route values as null, so now my controllers Login action gets a returnUrl value of null
@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink"…

chuckd
- 13,460
- 29
- 152
- 331
0
votes
1 answer
Convert a string into routeValues for call RedirectToAction
Is possible to convert a string into routeValues?
Per example:
return RedirectToAction("Index", "Home", new { id = 1});
to
return RedirectToAction("Index", "Home", "id = 1");
I am needing it because I want to save the routeValues in database.
I…

Dan
- 1,518
- 5
- 20
- 48
0
votes
2 answers
Passing selected button value from view to controller
I would like to pass the selected button value to the controller. See my code below.
In my controller I am passing through the ProductId which I will then use to set up my product value inside my controller.
Controller:
public ActionResult…

user1781232
- 659
- 4
- 13
- 29
0
votes
1 answer
RouteValueDictionary coming across as null in Extension method
Using bootstrap I ran into the problem of having to set the active class on certain links. I found this helper method out on the interwebs and was adding some functionality to it. Basically I wanted to add RouteValueDictionary and Html items to it.…

Tada
- 1,585
- 2
- 16
- 26
0
votes
0 answers
How to build custom URL link MVC
There are some methods like the followings in UrlHelper class in MVC4
public string Action(string actionName, object routeValues);
public string Action(string actionName, RouteValueDictionary routeValues);
...but i want to change route…

brtb
- 2,201
- 6
- 34
- 53
0
votes
1 answer
ASP.NET MVC: Is it possible to send custom route value with every form submiting?
I have my custom route like this
routes.MapRoute(
name: "child",
url: "{parcontroller}/{controller}/{action}/{id}",
defaults: new { id = UrlParameter.Optional },
constraints: new { }
);
When…

LLF
- 668
- 3
- 10
- 27
0
votes
2 answers
DateTime constraint on route with time?
How would a constraint for a route look like that needs to be in the format:yyyy-MM-dd hh:mm?
especially with the space there?
I got @"\d{4}-\d{2}-\d{2}" so far, but not sure about the rest
How's it done?
/M

Lasse Edsvik
- 9,070
- 16
- 73
- 109