Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
Pass multiple values thru RouteValueDictionary in ActionLink
Terry
7y
359
1
Reply
Hello,
I have buttons where I want to pass Model and other parameters to the Action method of the Controller. Using RouteValueDictionary, it allows me to send only 1 Key-Value pair. How do I add more than 1 Key-Value pair ?
View Code :
@* Using RouteValueDictionary
new
RouteValueDictionary(Model) -- shows result just of page 1,
as
page value not passed &
default
is
1
new RouteValueDictionary ({ mivm = Model, page = Model.CurrentPage + 1}) --- Model
is
null
in
Controller Index Action method
button type=
"button"
id=
"btnNext"
class
=
"btn btn-sm"
title=
"Next"
onclick=
"location.href='@Url.Action("
Index
", "
Member
", new RouteValueDictionary(new { mivm = Model, page = Model.CurrentPage + 1 })) )'"
@( (Model.CurrentPage == Model.TotalPages) ?
"disabled"
:
""
)><span
class
=
"glyphicon glyphicon-step-forward"
></span></button>
*@
Controller Action Method :
public
ActionResult Index(MemberIndexViewModel mivm,
int
page = 1,
string
sort =
""
,
string
sortdir =
"asc"
) {
........
}
Where am I going wrong and How to make this working ??
Any help is highly appreciated.
Thanks,
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
MVC : Binding dynamically added Checkboxes to the Model ???
when i am uploading .xls file in Asp.Net getting error: