Hi I am working on Asp.Net MVC application.
I have a page that has URL
http://localhost:7108/Carrier/viewnotes/4
Now In the above URL 4 is the "id" parameter for the controller method viewnotes.
What I want is to embed this parameter to the action of my current form
as
<form id="carrierinsert-form" action="/Carrier/AddNote/
atifciit
Member
1 Points
8 Posts
Getting Query String in MVC
Nov 26, 2008 02:08 PM|LINK
I have a page that has URL
http://localhost:7108/Carrier/viewnotes/4
Now In the above URL 4 is the "id" parameter for the controller method viewnotes.
What I want is to embed this parameter to the action of my current form
as
<form id="carrierinsert-form" action="/Carrier/AddNote/
shandyhidaya...
Participant
1296 Points
199 Posts
Re: Getting Query String in MVC
Nov 26, 2008 02:17 PM|LINK
Because you use "POST"
Try use :
Request.Form["id"];
Shandy Hidayat, MCPD
hassan.live
Member
132 Points
51 Posts
Re: Getting Query String in MVC
Nov 26, 2008 06:11 PM|LINK
you need to pass the id to the viewdata dictionary.
public ActionResult viewnotes(int? id) { ViewData["Id"] = id; return View(); }and in your view page do thisatifciit
Member
1 Points
8 Posts
Re: Getting Query String in MVC
Nov 27, 2008 05:08 AM|LINK