Is there a way to pass list as parameter for @url.action
or is there a better solution for this?
Pseudo code: This doesn't pass anything, unless I define index for my model or list.
@Url.Action("DeleteConfirmed", "Home", new { selectedids = /*model or list?*/ }, null)
I need to pass list or model to this:
public ActionResult DeleteConfirmed(List<int> selectedids) {
//Code
return View("Index");
}
I join them as a string and then convert that back on the server; this means selectedids would need to be a string on the server, which you would string split on comma and convert each value to long
.
@Url.Action("DeleteConfirmed", "Home", new { selectedids = String.Join(",", Model.IDS) })
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.