Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 09, 2011 08:59 PM by sam.pat
Member
195 Points
145 Posts
Jun 07, 2011 07:15 PM|LINK
Hi All,
How do I display my parameter from a controller to a view? For eg. If My controller action is following:
public ActionResult TestParam(string myName) { return View(myName); }
If I use the following URL: http://localhost:12121/Test/TestParam/Smith
I want to see "Smith" in HTML view.
How can I do this?
Thanks in advance
All-Star
118619 Points
18779 Posts
Jun 09, 2011 02:23 AM|LINK
Hello:) public ActionResult TestParam(string myName) { ViewData["myName"] = myName;
return View(); }
In your TestParam.aspx, please say——
<%=ViewData["myName"]%>;
Jun 09, 2011 08:59 PM|LINK
Thanks! Decker Dong!
sam.pat
Member
195 Points
145 Posts
HELP: Display parameter value in html view
Jun 07, 2011 07:15 PM|LINK
Hi All,
How do I display my parameter from a controller to a view? For eg. If My controller action is following:
public ActionResult TestParam(string myName) { return View(myName); }Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: HELP: Display parameter value in html view
Jun 09, 2011 02:23 AM|LINK
Hello:)
public ActionResult TestParam(string myName)
{
ViewData["myName"] = myName;
return View();
}
In your TestParam.aspx, please say——
<%=ViewData["myName"]%>;
sam.pat
Member
195 Points
145 Posts
Re: HELP: Display parameter value in html view
Jun 09, 2011 08:59 PM|LINK
Thanks! Decker Dong!