Questions tagged [routedata]
38 questions
0
votes
1 answer
How to access current route parameter from url and reference it on a asp.net view page
I just made a new route:
routes.MapRoute(
name: "example",
url: "{example}/{details}/{id}",
defaults: new { controller = "example", action = "Index", id = UrlParameter.Optional }
);
The route works fine but I do not know how to reference…

LjerkaKayode
- 3
- 3
0
votes
1 answer
ASP.NET MVC Passing ID from Controller to View
Hi I am trying to pass an ID from the URL from a controller to a view. I am also passing a viewmodel that contains two models that have data from a database. Is there another way of doing this? The routemap has been set to send an ID.
The URL would…

Zack Antony Bucci
- 571
- 1
- 12
- 29
0
votes
1 answer
Razor pages - RouteData null on Post
I am trying to learn MVC and Razor pages (I am new to web development) and I am having an NullReferenceException on Post because RouteData is null. I don't have this issue on the Get. The page loads normally, but as soon as I click the Filter…

Matias
- 35
- 1
- 8
0
votes
2 answers
Missing RouteData DataTokens
I'm handling errors in ASP.NET MVC by sending an error id from Application.OnError to a controller action, by adding a route data value that gives the error id:
Global.asax.cs/OnError:
var routeData = new…

Ole Lynge
- 4,457
- 8
- 43
- 57
0
votes
3 answers
Consistent way to access route value parameters passed through querystring
I have the following route defined in global.asax
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Portal", action = "Index", id = UrlParameter.Optional }
);
I can't control whether users access the page…

Failwyn
- 767
- 8
- 22
0
votes
1 answer
Unable to DataBind to ListView because of SelectMethod
I have a ListView and i use the SelectMethod of the ListView to populate it. I am looking to apply filters to the data returned from a DropDownList. The problem that i am facing is i cannot DataBind() on this ListView because of the SelectMethod…

jackncoke
- 2,000
- 6
- 25
- 66
0
votes
2 answers
RouteData lost on Post in a controller called by RenderAction
I have a "Resume" view which makes a call to RenderAction so I can add comments to a resume. Code:
@{Html.RenderAction("Add", "ResumeComment", new { resumeId = @Model.Id });}
So the code above calls Add action in my ResumeComment controller and…

user1322549
- 11
- 1
- 2
-1
votes
1 answer
Route/redirect to default action by calling the controler in url?
URL : localhost:4835/Login
public class LoginController : Controller
{
public ActionResult Index()
{ 'enter code here' }
}
i want to call index without mention a name of action.