How to send data through actionlink in asp.net? -



How to send data through actionlink in asp.net? -

in application trying make, have menu in view below:

<ul id="menu"> <li>@html.actionlink("create project", "display", "createdisplay")</li> <li>@html.actionlink("open", "about", "home")</li> </ul>

where createdisplay name of controller , display method in controller phone call view.

but, want display method take parameters username of person. in current view, have obtained username @viewdata["username"]

but not able pass these values using actionlink. tried passing parameters

<li>@html.actionlink("create project", "display?username="+@viewdata["username"], "createdisplay")</li>

but received exception.

please suggest ways of doing this.

thank much in advance.

you need utilize overload accepts parameters route values. see overloaded method actionlink() here.

@html.actionlink( "click me!", "display", "createdisplay", new { username = "setyourvalhere" }, null);

asp.net-mvc-3 actionlink

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -